
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 0.58 KB | hits: 9 | expires: Never
/// <summary>
/// Tests if a object is null.
/// Throws ArgumentNullException with passed message.
/// </summary>
/// <param name="theObj">a object instance</param>
/// <param name="msg">message to throw if the object is null</param>
public static void NotNull(object theObj, string msg) {
if (theObj == null) {
if (string.IsNullOrEmpty(msg)) {
msg = "A object instance can't be null";
}
throw new ArgumentNullException(msg);
}
}