Could anyone tell me how to group data in a generic list (VB.Net).
I have created a Generic List of a custom ojbect and I am adding to the list line by line (after some manipulation of the data) I now need to Group the data so as not to have any duplicated lines in the array - I can't do this at the data level as I am using 3rd party data objects.
Example code:
Dim ds As DataObjectDataSource
Dim genList As Generic.List(Of Object)
For each row in ds
Dim obj As Object
With obj
.Category = row.Category
.Tonnes = row.Tonnes
End With
genList.Add(obj)
Next
So from something like this, I would like to end up with a list of objects grouped by the Category and for the Grouped Tonnes figure to be a sum for each category.
Hope that makes sense - and that someone can talk me through it!! :)