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赋值
&
相关文档:
SQL中有四种基本的DML操作:INSERT,SELECT,UPDATE和DELETE。
INSERT语句
用户可以用INSERT语句将一行记录插入到指定的一个表中。例如,要将雇员John Smith的记录插入到本例的表中,可以使用如下语句:
INSERT INTO EMPLOYEES VALUES
('Smith','John','1980-06-10',
'Los Angles',16,45000);
......
<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" ......
public class yzzSerialize
{
private yzzSerialize()
{ }
private static yzzCache cache = new yzzCache();
public static T GetfromXml<T>(string xmlpath, T t)
{
using (FileStream fs = new FileStream(xmlpath, FileMode.Open, FileAcces ......
/// <summary>
/// 支持XML序列化的泛型 Dictionary
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TValue"></typeparam>
[XmlRoot("SerializableDictionary")]
public class SerializableDictionary<TKey, TValue& ......
RT。先贴代码
C# code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Value_Ref_test1
{
class Program
{
static void Main(string[] args)
{
point a = new point (10,10) ;
point b = a;
......