📜  lista generica como parametro de un metodo en c# Code Example

📅  最后修改于: 2022-03-11 14:49:18.899000             🧑  作者: Mango

代码示例3
List emp = new List();

//Maintaining DataTable on ViewState
//For Demo only

DataTable dt = ViewState["CurrentEmp"] as DataTable;

//read data from DataTable 
//using lamdaexpression


emp = (from DataRow row in dt.Rows

   select new Employee
   {
       _FirstName = row["FirstName"].ToString(),
       _LastName = row["Last_Name"].ToString()

   }).ToList();