2017-10-20 97 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