对于以下情况,C#(或任何支持方法重载的面向对象的语言)是否有任何约定?
说我有一个方法foo:
public void Foo(int a){//does stuff}
但实际上我有3种方法foo:
public void Foo(int a){} public void Foo(int a,double b){} public void Foo(float c,int a,double b){}
解决方法
就在这里.看看
https://msdn.microsoft.com/en-us/library/ms229029(v=vs.110).aspx
Do be consistent in the ordering of parameters in overloaded members. Parameters with the same name should appear in the same position in all overloads.