Faster way to perform checks on method arguments
- by AndyC
This is mostly just out of curiosity, and is potentially a silly question. :)
I have a method like this:
public void MyMethod(string arg1, string arg2, int arg3, string arg4, MyClass arg5)
{
// some magic here
}
None of the arguments can be null, and none of the string arguments can equal String.Empty.
Instead of me having a big list of:
if(arg1 == string.Empty || arg1 == null)
{
throw new ArgumentException("issue with arg1");
}
is there a quicker way to just check all the string arguments?
Apologies if my question isn't clear.
Thanks!