Hi,
I've made my own class (we'll call it myClass) to simply store some
data. I'm storing multiple instances myClass in a list:
List<myClass> myList = new List<myClass>();
myList.Add(new myClass(somedata));
myList.Add(new myClass(somemoredata));
I'm then iterating over myList using a for loop. To neaten my code i
decided to use a foreach, but of course, when i do that i get some
serialization error because myClass doesnt implement GetEnumerator.
I've read this:
http://www.vijaymukhi.com/documents/...ics/chap13.htm
but I'm still not very clear on how I need to modify myClass to enable
foreach-ing.
Can someone please advise me?
Thanks,
Andrew
Below is the code for myClass:
////////////
internal class myClass
{
public int X;
public int Y;
public myClass(int _x, int _y)
{
X = _x;
Y = _y;
}
}
}