public static ICollection <T> CargarDatos <T>(DataTable data) where T : class, new() { if (data == null || data.Rows == null || data.Rows.Count == 0) { return((ICollection <T>)null); } Dictionary <string, string> columnNames = UtilBD.ObtenerNombreColumnas <T>(data.Columns); ICollection <T> objs = (ICollection <T>) new Collection <T>(); foreach (DataRow row in (InternalDataCollectionBase)data.Rows) { T obj = UtilBD.CargarDato <T>(row, columnNames); objs.Add(obj); } return(objs); }