Is there any sort of convention in C# (or any object oriented language that supports method overloading) for the following situation?
Lets say I have a method foo:
public void Foo(int a){//does stuff}
But actually I have 3 methods foo:
public void Foo(int a){}
public void Foo(int a, double b){}
public void Foo(float c, int a, double b){}
Is there a convention that states whether or not the order of parameters matters in an overloaded method? Notice how the 3rd method doesn't an obvious logical progression (a,b,c).
Yes there is. Have a look at 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With