I often need to perform LinQ queries to get distinct items from a IEnumerable based on one of its properties. I would like to know if this is a good way to wrap this operation:<Extension()> Function DistinctOn(Of T)(iet As IEnumerable(Of T),                                        identity_property As Func(Of T, Object)                                       ) As IEnumerable(Of T)    Return iet.GroupBy(identity_property).Select(Function(g) g.First)End FunctionUsing example (pastas is a IEnumerable of Newtonsoft.Json.Linq.JObject):Dim dpastas = pastas.DistinctOn(Function(jo) jo.Value(Of Integer)(id)).ToArrayIt works Ok, but I'd like to know if it is good code also. Thank you very much!
LinQ wrapper to get distinct items from a IEnumerable based on a function of item
linq;vb.net