I have classes:
Public Class Data
Public Property ColumnList As List(Of Column)
Public Property RowList As List(Of Row)
End Class
Public Class Row
Public Property CellList As List(Of Cell)
End Class
Public Class Column
Public Property name As String
End Class
Public Class Cell
Public Property value As Object
Public Property col As Column
End Class
Then I want to check if a List of columnnames would be a Primary Key (like in SQL) for the data, e.g.
ColumnFieldNames = {"FieldA", "FieldB"}
ColumnList contains 3 Columns named FieldA, FieldB, FieldC.
RowList contains 3 CellLists each filled with values for FieldA, FieldB, FieldC and a reference to the Column.
Data.ColumnList(0).name = "FieldA"
Data.ColumnList(1).name = "FieldB"
data.RowList(0).CellList(0).value = 1
data.RowList(0).CellList(0).column = ColumnList(0)
data.RowList(0).CellList(1).value = 2
data.RowList(0).CellList(1).column = ColumnList(1)
data.RowList(1).CellList(0).value = 34
data.RowList(1).CellList(0).column = ColumnList(0)
data.RowList(1).CellList(1).value = 2
data.RowList(1).CellList(1).column = ColumnList(1)
etc.
I'd like some kind of group by ... having count(*) > 1
or select count(1) - Statement so if I would choose FieldB as ColumnFieldNames it would return something, as there are more than one row containing CellList.value = 2. If I would choose {"FieldA", "FieldB"} as ColumnFieldNames it would return nothing.