Last active
December 27, 2015 08:39
-
-
Save IanWold/7297463 to your computer and use it in GitHub Desktop.
When you need to check for null arguments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void ThrowArgNullException(params object[] args) | |
{ | |
for (int i = 0; i < args.Count(); i++) | |
{ | |
if (args[i] == null) throw new ArgumentNullException("Argument Number " + i); | |
} | |
} | |
public static void ThrowArgNullException(string[] ArgNames, params object[] args) | |
{ | |
for (int i = 0; i < args.Count(); i++) | |
{ | |
if (args[i] == null) throw new ArgumentNullException(ArgNames[i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment