Select multiple columns using Entity Framework

前端 未结 7 1526
逝去的感伤
逝去的感伤 2021-01-31 07:10

Maybe an easy question, but can\'t find it easily so forgive me =) I try to select multiple columns. The statement I use is:

var dataset2 = from recordset in ent         


        
7条回答
  •  忘掉有多难
    2021-01-31 07:53

    Why don't you create a new object right in the .Select:

    .Select(x => new PInfo{ 
        ServerName = x.ServerName, 
        ProcessID = x.ProcessID, 
        UserName = x.Username }).ToList();
    

提交回复
热议问题