C
C#2y ago
KidKai25

❔ How are we able to use AsEnumerable to something old class like DataTable? Tell me like I am 10.

DataTable came first than AsEnumerable. How did they do it?
8 Replies
Jimmacle
Jimmacle2y ago
not sure what you mean it's an extension method, but in general you can add new things to old code
KidKai25
KidKai25OP2y ago
if I wear to to check the implementation of the extention method i.e. AsEnumerable() for DataTable. What do you think we would find?
Jimmacle
Jimmacle2y ago
you can check it easily, i did before answering the question it's just a custom enumerator that iterates over the rows of the table
KidKai25
KidKai25OP2y ago
What's the site I misplaced it.
KidKai25
KidKai25OP2y ago
so beautiful hmmm I wish I could write code like this /// <summary> /// This class provides a wrapper for DataTables to allow for querying via LINQ. /// </summary> public class EnumerableRowCollection<TRow> : EnumerableRowCollection, IEnumerable<TRow>
Jimmacle
Jimmacle2y ago
like what?
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server