Check Null

Niladri.Biswas
Posted by Niladri.Biswas under C# category on | Points: 40 | Views : 806
public static T CheckNull<T>(this IDataRecord reader, int ordinal)
{
if (reader == null) throw new ArgumentNullException("reader");
return reader.IsDBNull(ordinal) ? default(T) : (T)reader[ordinal];
}

Comments or Responses

Login to post response