
正文
C#实现函数默认值和C#4.0实现默认值
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
static void Main(string[] args)
{
SayHello("侯志强", );
SayHello("侯志强"); Console.ReadKey();
} C#.0实现参数的默认值
static void SayHello(string strName,int nAge=)
{
Console.WriteLine("我的名字是{0},今年{1}岁", strName, nAge);
} //C#4.0以前实现参数默认值
static void SayHello(string strName1, int nAge)
{
Console.WriteLine("我的名字是{0},今年{1}岁", strName1, nAge);
} static void SayHello(string strName1)
{
SayHello(strName1, );
}
来自:http://blog.csdn.net/yisuowushinian/article/details/7566823







