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.

Poll Results : Do you have a use case for CoreWCF?

CoreWCF is a port of WCF to .NET Core. It’s a community project but will be supported by Microsoft and is intended to help migrate .NET framework apps to more recent versions like .NET 5/6.

Note… Microsoft still recommends using something like gRPC or REST APIs for greenfield projects.

Have you a use case for this or have you already dropped all WCF services and moved to other service approaches available in .NET Core?

I asked this question a while ago on my LinkedIn page and although the number of votes was relatively low at 104 I was still kind of surprised that nearly 40% of devs thought they might have a use case for it.

How to automatically add missing using statements when we paste code in Visual Studio

In Visual Studio when we paste code into our files often it won’t compile as we need to add using directives first.

Thankfully Visual Studio has a useful setting which causes it to add any missing using directives when we paste.

To enable check the box highlighted below…