from and select in c# .net?

前端 未结 5 1001
后悔当初
后悔当初 2021-01-29 10:02

Can anyone Please tell me how to specify the particular column in the select statement given below:

var combinedrows = from dt1 in DsResults.Tables[0].AsEnumerab         


        
5条回答
  •  生来不讨喜
    2021-01-29 11:02

    Well, it's not really clear what you want, but something like this, perhaps?

    var combinedRows = from dt1 in DsResults.Tables[0].AsEnumerable()
                       join dt2 in DsResults.Tables[1].AsEnumerable()
                         on dt1.Field("MethodName") 
                         equals dt2.Field("MethodName")
                       select new { MethodName = dt1.Field("MethodName"),
                                    Foo = dt2.Field("Foo"),
                                    Bar = dt1.Field("Bar") };
    

提交回复
热议问题