static void Main(string[] args)
{
int i = 1; Test(i); Console.WriteLine(i);//这里想将i变成5,不知道怎么写
} public static void Test(int a)
{
a = 5;
return;
}
{
int i = 1; Test(i); Console.WriteLine(i);//这里想将i变成5,不知道怎么写
} public static void Test(int a)
{
a = 5;
return;
}
public static void Test(ref int a)
{
a = 5;
return;
}传址引用 .
{
int i = 1; Test(ref i); Console.WriteLine(i); }public static void Test(ref int a)
{
a = 5;
}