I would like to convert the following DataTable into a collection:
where the keys are strings and the values are lists of strings, the keys will have the User ID and the lists will have all the Invoices ID that belong to that user. I am using LINQ and so far I have the following statement:
dt.AsEnumerable().GroupBy(Function(r) r("User"), Function(r) r("Invoice")).ToDictionary(Function(g) g.Key, Function(g) g.ToList())
But I would like to be able to validate that only the elements appearing in the collection (Users and Invoices) are the ones where the column “Existence” is equal to “Y”. Could someone help me add this validation in my instruction? How can I validate this to only add to the collection the values where the invoices exist?