Object still linked (referenced) after selecting it out of list?
Posted
by djerry
on Stack Overflow
See other posts from Stack Overflow
or by djerry
Published on 2010-05-18T11:52:23Z
Indexed on
2010/05/18
12:00 UTC
Read the original article
Hit count: 118
Hey guys,
I was wondering, and i'm not really sure, but help me out here.
If you have a List items, and there's one object you need to change a property of it. Say myClass has a string property "status". I'm searching my list with a for-loop and i get my object so i do
myClass item = items[i];
if i want to change the "status" property, i do this for example :
item.Status = "new status";
My question/issue is this: is "item" still linked to the list item, so that if i execute the line above, it will be changed in the list as well without having to set this :
items[i] = item;
Hope this is clear.
Thanks in advance.
© Stack Overflow or respective owner