重载方法
public static void PrintHello(){
    Console.WriteLine("Hello");
}
public static void PrintHello(string s){
    Console.WriteLine("hello{0}",s);
}

通过参数的数量和类型的不同来实现同名的方法,执行不同的功能。


首页 我的博客
粤ICP备17103704号