class Program
{
static void Main(string[] args)
{
double start1=0;
double end1=0;
Test1(start1,end1);
Console.WriteLine("test1:"+start1+"------"+end1);//0---0
double start2 = 0;
double end2 = 0;
Test2(ref start2, ref end2);
Console.WriteLine("test2:" + start2 + "------" + end2);//1000----2000
Console.ReadLine();
}
private static void Test1(double a,double b)
{
a = 1000;
b = 2000;
}
private static void Test2(ref double a,ref double b)
{
a = 1000;
b = 2000;
}
}
C# ref使用
最新推荐文章于 2024-05-23 13:35:39 发布