I need a help on Reflection.
I am facing a problem while Iterating the List in reflection.
var item = property.GetValue(obj,null); //This will return List of Student. Actually We dont know the type of obj ie Student, as it is in Reflection.
foreach(var value in (item as IEnumerable))
{
//Do stuff
}
if i do like this i am getting error like,
Using the generic type 'System.Collections.Generic.IEnumerable
Please help me.


VulpesRank #55 · 29.2K reputationPosted May 10, 2011, 5:51 AM EDT
using System.Collections.Generic;
If you add the non-generic version as well, then your code should work:
using System.Collections;
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted May 10, 2011, 9:08 PM EDT
Yes vulpes, Its working.. Thanks..