public static List<T> ConvertToList(DataTable dt) { // 定義集合 List<T> ts = new List<T>(); // 獲得此模型的類型 Type type = typeof(T); //定義一個(gè)臨時(shí)變量 string tempName = string.Empty; //遍歷DataTable中所有的數(shù)據(jù)行 foreach (DataRow dr in dt.Rows) { T t = new T(); ...
www.dbjr.com.cn/article/426...htm 2025-5-18