X
Xandau
hello all,
i wotk with java every day but last time i have interested in C#.
everything goes great except one thing...
in java everything is a reference (except plain types) so i thought
that in C# will be the same - i was wrong....
or if in C# is the same as in java please tell me ;-)
I have an ArrayList names ls :
// Point is a class System.Draw....
// Please excuse me an errors in code, but i write it from my head ;-)
ArrayList ls = new ArrayList[2];
ls[0] = new Point(0,0);
ls[1] = new Point(10,10);
Point p = (Point) ls[0];
p.X = 20;
p.Y = 20;
// print p.ToString()
// ((Point) ls[0]).ToString()
// please notice that (p!= (Point) ls[0]) = TRUE
why p is a copy of object Point stored as first element of ArrayList
(ls[0])???
Do i something wrong???
I was browsing MSDN but i haven't found an explanation of situation
presented above.
i wotk with java every day but last time i have interested in C#.
everything goes great except one thing...
in java everything is a reference (except plain types) so i thought
that in C# will be the same - i was wrong....
or if in C# is the same as in java please tell me ;-)
I have an ArrayList names ls :
// Point is a class System.Draw....
// Please excuse me an errors in code, but i write it from my head ;-)
ArrayList ls = new ArrayList[2];
ls[0] = new Point(0,0);
ls[1] = new Point(10,10);
Point p = (Point) ls[0];
p.X = 20;
p.Y = 20;
// print p.ToString()
// ((Point) ls[0]).ToString()
// please notice that (p!= (Point) ls[0]) = TRUE
why p is a copy of object Point stored as first element of ArrayList
(ls[0])???
Do i something wrong???
I was browsing MSDN but i haven't found an explanation of situation
presented above.