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
Don't know if this technique transfers from C/C++ to C#, but I've done this with macros:
#define CHECK_NULL(x) { (x) != NULL || \ fprintf(stderr, "The value of %s in %s, line %d is null.\n", \ #x, __FILENAME__, __LINE__); }