Good morning,
I've noticed that when you assign a list as a parameter to an object and then make changes to it, the object's parameter also changes its value.
I would like to know how to avoid this and how to delete my list without affecting my object.
Reconstruction :
List<string> images = new List<string>
{
"1",
"2",
"3"
};
Message messageA = new Message(objet, rtfMessage, images, date_de_publication, texteEtat, couleurEtat);
// messageA.images = 1 , 2 , 3
images.Clear();
// messageA.images = new List<string>()
Thanks
EDIT
Here's a solution I found, but it's not very optimized;
string[] vs = images.ToArray();
Message message = new Message(objet, rtfMessage, vs.ToList(), date_de_publication, texteEtat, couleurEtat);