Please explain about IEnumerable in easy way and why we need?
List Yrs = new List();
Yrs.Add(1992);
Yrs.Add(1993);
Yrs.Add(1994);
Yrs.Add(1996);
Yrs.Add(1997);
Yrs.Add(1998);
// IEnumerable ienum = (IEnumerable)Yrs;
foreach (int i in Yrs)
{
Console.WriteLine(i);
}
With out IEnumerable also foreach loop works what is the need?

Amit MohantyRank #112 · 20K reputationPosted Sep 16, 2019, 12:49 AM EDT
Amit KumarRank #459 · 5.4K reputationPosted Sep 16, 2019, 7:43 PM EDT
Jayanth ReddyRank #8,652 · 218 reputationPosted Sep 17, 2019, 11:14 PM EDT