KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In C#, are there any good reasons (other than a better error message) for adding parameter null checks to every function where null is not a valid value? Obviously, the code that uses s will throw an exception anyway. And such checks make code slower and harder to maintain. void f(SomeType s) { if (s == null) { throw new ArgumentNullException("s cannot be null."); } // Use s }
Tags (comma-separated)
Save Edits
Cancel