C# – The nameof() operator

In C# 6 they added the nameof() operator. This outputs the name of the object passed in: nameof() eliminates duplication The DRY principle – Don’t Repeat Yourself – warns us against having duplication in the code. Whenever information or code is duplicated, it’s possible to change something in one spot but forget to change it … Read more

C# – How to call a static method using reflection

Here’s how to call a static method using reflection: Note: This static method is parameterless. If you have parameters, you have to pass them in like this .Invoke(null, param1, param2). Example – passing static method names to a parameterized unit test With parameterized tests you can only pass in compile-time constants. This means you can’t … Read more