C#中ref参数与out参数的区别
先贴代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ref_and_Out_test
{
class Program
{
static void Main(string[] args)
{
int a =0; //若不初始化b会产生编译时错误。使用未初始化变量
int b = 1; //即使不初始化b也没有问题;
RefAndOut(ref a,out b);
Console.WriteLine("after RefAndOut method process");
Console.WriteLine("a={0},b={1}", a, b);
}
static void RefAndOut(ref int a,out int b)
{
//b = 1; //若此处不进行初始化,则try to print b这个语句无法执行
Console.WriteLine("before change ref a=0 and out b =1 value");
//try to print b:Console.WriteLine("a={0},b={1}", a, b);
Console.WriteLine("Now change the value,a to 123 ,b to 999");
a = 123;
b = 999; //若在方法内不对b赋值,则会出现编译时错误提醒必须对b赋值
&
相关文档:
1
<asp:UpdatePanelID="UpdatePanel1"
UpdateMode="Conditional"
runat="server">
<ContentTemplate>
<asp:Button ID="Button1"
......
连接sql server数据库用到的命名空间是using System.Data.SqlClient;
数据库连接代码:可以在大类之下声明 public SqlConnection myConnection; //sql连接对象
&nbs ......
<Language from="SQL" To="C#">
<Type from="bigint" To="long" />
<Type from="binary" To="object" />
<Type from="bit" To="bool" />
<Type from="char" To="string" />
<Type from="datetime" To="DateTime" ......
C#
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("~/Config/User_yhlx_Jb.xml"));
DataView dv = ds.Tables[0].DefaultView;
//dv.RowFilter = "State=0";
this.DropDownList1.DataSource = dv;
this.DropDownList1.DataTextField = "text";
this ......