日期:2014-05-17 浏览次数:20934 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace helloworld
{
class Program
{
static void Main(string[] args)
{
int a = 0;
Console.WriteLine(a.ToString()); //输出是0
public void modifyvalue(ref int a)
{
a=1;
}
Console.WriteLine(a.ToString()); //输出是1
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace helloworld
{
class Program
{
static void Main(string[] args)
{
int a = 0;
Console.WriteLine(a.ToString()); //输出是0
modifyvalue(ref a);
Console.WriteLine(a.ToString()); //输出是1
Console.ReadKey();
}
}
public static void modifyvalue(ref int a)
{
a=1;
}
}