Convert DataRowCollection to IEnumerable<T>

Abdu picture Abdu · Feb 11, 2011 · Viewed 49.3k times · Source

I would like to do something like this in .NET 3.5. What's the quickest way?

IEnumerable<DataRow> collection = 
    TypedDataSet.TypedTableBase<DataRow>.Rows as IEnumerable<DataRow>;

Answer

wsanville picture wsanville · Feb 11, 2011

You can call OfType<DataRow>() on the DataRowCollection.