I’m refactoring some code and adding a method which will replace a (soon-to-be) deprecated method. The new method has the following signature:
FooResult Foo
You need to add a check for the args itself to be non-null. The ANE is not appropriate for individual components, so you need to use more general AE, like this:
if (args == null)
throw new ArgumentNullException(“args”);
if (args.Property1 == null)
throw new ArgumentException(“Property1 cannot be null.”, “args”);
if (args.Property... == null)
throw new ArgumentException(“Property... cannot be null.”, “args”);
if (args.PropertyN == null)
throw new ArgumentException(“Property2 cannot be null.”, “args”);