雜學雜學雜學雜學雜學
阿新 • • 發佈:2020-09-01
1
作用: 將table轉化list,,,且更改list的泛型 var dataRows = DbHelperOra.GetTable(sql).AsEnumerable().ToList(); List<dynamic> rows = dataRows.ConvertAll<dynamic>(x => x); 或------------- var dt = DbHelperOra.GetTable(sql); var rows = dt.AsEnumerable().Select(row => new B_CERTIFICATE() { C_ID = row["C_ID"], T_ID = row["T_ID"], C_NAME = row["C_NAME"], C_NUMBER = row["C_NUMBER"], C_ISSUEDATE = row["C_ISSUEDATE"], C_REGISTERDATE = row["C_REGISTERDATE"], C_ENDDATE = row["C_ENDDATE"], C_SURPLUSDAY = row["C_SURPLUSDAY"], }).ToList(); public class B_CERTIFICATE { public dynamic C_ID { get; set; } public dynamic T_ID { get; set; } public dynamic C_NAME { get; set; } public dynamic C_NUMBER { get; set; } public dynamic C_ISSUEDATE { get; set; } public dynamic C_REGISTERDATE { get; set; } public dynamic C_ENDDATE { get; set; } public dynamic C_SURPLUSDAY { get; set; } }