Total: 7 Average: 3.9
At the method input, we often perform a null test. Someone makes the test as a separate method, so that the code looks cleaner, and gets something like this:
public void ThrowIfNull(object obj) { if(obj == null) { throw new ArgumentNullException(); } }
The interesting thing about this test is that I see a frequent use of the object attribute, though you can use generic. Let’s try to replace our method with generic and compare performance.