2017-10-20 58 views
1

我有一个mapha的对象的数据表,我想通过Object.baseshape.label.y这是一个double值来排序这个列表。我如何使用Linq来做到这一点? 我已经实现这个代码到目前为止通过对象的属性使用Linq命令Vb.Net

Dim query As IEnumerable(Of DataRow) = From result In dataArray.AsEnumerable() Order By result.Field(Of Object)("MapShapes") Descending 

,但我想是这样的

Dim query As IEnumerable(Of DataRow) = From result In dataArray.AsEnumerable() Order By result.Field(Of Object)("MapShapes")..baseshape.label.y Descending 
+1

而不是Field(Of Object),你可以使用Field(OfWhateverConcreteTypeItReallyIs)吗? – dwilliss

+1

是的,我可以,这就是答案。类型是MapSuite.BaseMapShape – vicangel

回答

1

您可以在现场使用特定对象类型(...)这样...

Dim query = From result In dataArray.AsEnumerable() Order By result.Field(Of MapSuite.BaseMapShape)("MapShapes").label.y Descending