您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

C# 中重载方法有哪些不同的方式?

2024/4/12 23:13:20发布16次查看
重载方法的不同方式是 -
the datatypes of parameters are differentthe number of parameters are different
下面给出了一个示例,说明参数的不同数据类型 -
void print(int i) { console.writeline("printing int: {0}", i );}void print(double f) { console.writeline("printing float: {0}" , f);}void print(string s) { console.writeline("printing string: {0}", s);}
下面列出了不同数量的参数 -
// two parameterspublic static int muldisplay(int one, int two) { return one * two;}// three parameterspublic static int muldisplay(int one, int two, int three) { return one * two * three;}// four parameterspublic static int muldisplay(int one, int two, int three, int four) { return one * two * three * four;}
以上就是c# 中重载方法有哪些不同的方式?的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product