Hi,
I have two methods:
Public Function GetTotalLimit(ByVal entity As Entity) As Int64
Return (From c In entity.Collection
Select c.Limit).Sum()
End Function
Public Function GetTotalUsed(ByVal entity As Entity) As Int64
Return (From c In entity.Collection
Select c.Used).Sum()
End Function
I have a feeling that these can be refactored to one single method with the signature:
Public Function GetTotal(Of TKey)(ByVal entity As Entity, ByVal field As Func(Of CollectionType, TKey)) As Int64
End Function
I come from a C# background which is hindering me to figure out the meat of this method. Anyone can help?