Don't write the same code over and over again and rather save these two code snippets to simplify your coding. YOu will still have the same code in your methods, but will gain two main things:
- You will be faster doing this as code snippet template will do majority of typing for you
- You won't misspell parameter name when providing its testual name to exception constructor
So until we get Visual Studio 2014 with new C# ?.
operator this is the simplest way without additional code in the form of either extension methods or other things.
ONe is for null parameter checking and the other for strings that they're not null
or whitespace.