public T GetValue <T>(int ordinal) { object value = reader.GetValue(ordinal); var toType = typeof(T); var fromType = value.GetType(); if (fromType == toType) { return((T)value); } if (value == DBNull.Value) { return(default(T)); } if (toType == DLinq.BinaryType) { return((T)DLinq.BinaryCtor(value as byte[])); } return((T)Converter.Convert(value, typeof(T))); }