Having a user defined class, like this:
class Foo
{
public int dummy;
public Foo(int dummy)
{
this.dummy = dummy;
}
}
And having then something like this:
ArrayList dummyfoo = new ArrayList();
Foo a = new Foo(1);
dummyfoo.add(a);
foreach (Foo x in dummyfoo)
x.dummy++;
How much is a.dummy?
How can i create my ArrayList so that a.dummy equals 2, meaning that my ArrayList contains basically pointers to my objects and not copies.
See Question&Answers more detail:os