Visual Studio: Regular expression to apply NameOf operator in C#

ArgumentNullException

In this example we will use capturing groups to extract parts of the regular expression match. The captured value, the parameter name string literal, is then replaced with the nameof expression.

ArgumentOutOfRangeException

We can perform the same find and replace operation for the ArgumentOutOfRangeException. This exception also expects the first argument to be the name of a method parameter.

Related

--

--

Website: www.coragi.com

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store