How to get minimum value from an of type list gene

2019-08-25 00:36发布

I'm returning a list of database records;

Dim rsPublicChilds As System.Data.Linq.ISingleResult(Of spGetPublicObjectsResult) = Nothing

rsPublicChilds = dc.spGetPublicObject(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

1条回答
姐就是有狂的资本
2楼-- · 2019-08-25 01:21

You can write

someCollection.Min(Function(x) x.SomeProperty)
查看更多
登录 后发表回答