I have a class containing several properties (all are strings if it makes any difference).
I also have a list, which contains many different instances of the class.
While creating some unit tests for my classes I decided I wanted to loop through each object in the list and then loop through each property of that object...
I thought doing this would be as simple as...
foreach (Object obj in theList)
{
foreach (Property theProperties in obj)
{
do some stufff!!;
}
}
But this didnt work! :(
I get this error...
"foreach statement cannot operate on variables of type 'Application.Object' because 'Application.Object' does not contain a public definition for 'GetEnumerator'"
Does anyone know of a way of doing this without tons of ifs and loops or without getting into anything too complex?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…