A common problem in any language is to assert that parameters sent in to a method meet your requirements, and if they don\'t, to send nice, informative error messages. This
This may be somewhat helpful:
Design by contract/C# 4.0/avoiding ArgumentNullException