How to get minimum value from an of type list generated from Linq to SQL
I'm returning a list of database records;
Dim rsPublicChilds As System.Data.Linq.ISingleResult(Of spGetPublicObjectsResult) = Nothing
rsPublicChilds = dc.spGet开发者_StackOverflowPublicObject(slintLoginID, lintLanguageID, lintObjectID, lintObjectTypeID, lstrSEOURL, lstrValid)
I get an enumerable list of rsPublicChildObjects that I then convert to an array;
Dim larr_PublicChild As IEnumerable(Of spGetPublicObjectsResult) = rsPublicChilds.toArray()
That then gives me easy access to an array of the objects, so I can then do;
larr_publicchild(0).colMyValue
etc.etc
I'd like to get the minimum value of colMyValue (or any other property of the object that's been created for me) but I can't quite see how to get there.
thanks Andy
You can write
someCollection.Min(Function(x) x.SomeProperty)
精彩评论