With every new version of C# a new version of Resharper appears. It teaches me the new language features and how I can write my code in the new way. It’s not always right as the code it converts to can be unmaintainable so you have to be careful. But every now and then it makes me realise why I pay for a great productivity tool.

public FeatureController(ApplicationDbContext applicationDbContext)
{
	if (applicationDbContext == null)
	{
		throw new ArgumentNullException("applicationDbContext", "Argument cannot be null.");
	}
	_applicationDbContext = applicationDbContext;
}

With a swift alt+enter with the carot over if (applicationDbContext == null) it makes it …

public FeatureController(ApplicationDbContext applicationDbContext)
{
	_applicationDbContext = applicationDbContext ?? throw new ArgumentNullException("applicationDbContext", "Argument cannot be null.");
}

Another well place alt+enter over "applicationDbContext" and it makes it …

public FeatureController(ApplicationDbContext applicationDbContext)
{
	_applicationDbContext = applicationDbContext ?? throw new ArgumentNullException(nameof(applicationDbContext), "Argument cannot be null.");
}

Spot on! Love Resharper!

Remember though …

With great power comes great responsibility.

Any questions/comments then please contact me on Twitter @WestDiscGolf