advertise with us

Consider using named arguments in C# to increase readability of method calls

By using named arguments in C# we don’t have to match the ordering of parameter lists of called methods. Instead the matching parameter for each argument can be specified by parameter name.

I never use these to change the position of arguments passed in as I find that can confuse other developers but I often use named parameters to improve the readability of a method call…

For example if I have two arguments both of the same type and am passing in constants I might include the argument names for clarity

Turn on inline parameter hints in Visual Studio instead

If we prefer we can turn on inline parameter hints in Visual Studio so it will show the parameter names even though they are not in the code.


Need Help with Your C# Projects?

We offer expert support and development services for projects of any size. Contact us for a free consultation and see how we can help you succeed.

CONTACT US NOW