"Gary" <(E-Mail Removed)> a écrit dans le message de news:
BE8B04EA-1C2D-46F4-8D58-(E-Mail Removed)...
|I am using List<MyClass> to store a bunch of MyClasses. And in my program,
I
| want to change the content of one class in this list. However, it seems to
me
| that this list keeps an original copy and is only "readable".
|
| Following is my code:
|
| int index = GetMyClassIndFromName(string);
|
| if (index != -1)
| {
| MyClass mf = m_allMyClass[index];
| mf.Available = true;
| }
|
| I think the mf is just a temporary copy of that MyClass. How may I change
| the original content?
No, mf is just another reference to the same object held in the list. So if
you change the properties of mf, you will also see those changes in the
properties of the object in the list; as they are one and the same object.
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer