[Mono-list] assertions in code?

Daniel Weber daniel-weber@austin.rr.com
Wed, 14 Nov 2001 22:59:16 -0600


I'm coding up XmlAttributeCollection and I've been putting statements in 
functions like:

public virtual void CopyTo(XmlAttribute [] array, int index)
{
  if (array == null)
    throw new ArgumentNullException("null array argument in CopyTo()");
  ...
}

Is there an equivelant to assert in C#?  Is there some kind of standard for 
when I should check, and what I should do if null is passed in?  Some methods 
in the MSDN documentation explicitly call for null arguments to return 
certain values, but most of them don't say anything, nor do they list the 
ArgumentNullException in the exception section.

Any input?