我有以下LINQ查询的数据表:LINQ查询,加入多个选择
string[] sourceNames = this.dt
.AsEnumerable()
.Select<System.Data.DataRow, String>(x => x.Field<String>("Name"))
.ToArray();
string[] sourceSurnames = this.dt
.AsEnumerable()
.Select<System.Data.DataRow, String>(x => x.Field<String>("Surname"))
.ToArray();
string[] sourceSecondSurnames = this.dt
.AsEnumerable()
.Select<System.Data.DataRow, String>(x => x.Field<String>("Second Surname"))
.ToArray();
string[] src = sourceNames.Union(sourceSurnames).Union(sourceSecondSurnames).ToArray();
表具有某些领域,他们中的一些上面:名,姓,二姓......等等。
我在这里要做的是只加入一个三个linq查询。最终目标是获得一组字符串,即src。
我该怎么做?
那么,什么是不与上面的代码工作? – DavidG
你目前的代码是做什么的?这与你想要的**有什么不同? – mjwills