Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.58 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /// <summary>
  2.         /// Tests if a object is null.
  3.         /// Throws ArgumentNullException with passed message.
  4.         /// </summary>
  5.         /// <param name="theObj">a object instance</param>
  6.         /// <param name="msg">message to throw if the object is null</param>
  7.         public static void NotNull(object theObj, string msg) {
  8.             if (theObj == null) {
  9.                 if (string.IsNullOrEmpty(msg)) {
  10.                     msg = "A object instance can't be null";
  11.                 }
  12.  
  13.                 throw new ArgumentNullException(msg);
  14.             }
  15.         }