I have two classes:
public class Row : Dictionary<string,string> {}
public class Table : List<Row> {}
In a method which should returns an object of type Table, I try to filter an object of type Table with the Where-Statement and return this object after filtering.
Table table = new Table();
table = tableObject.Where(x => x.Value.Equals("")).ToList();
return table;
My problem is the cast of the resulting IEnumerable.
- Conversion with (Table) throws an InvalidCastException
Additional information: Unable to cast object of type 'System.Collections.Generic.List`1[Row]' to type 'Table'.
- Conversion with as Table results in an null object
How can I return an object of type Table out of an IEnumerable?