Click here to Skip to main content
11,928,987 members (54,448 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
I have two forms. Both of the forms, I have two lists of strings. From the FORM 1 I have sent two list to FORM 2 by calling the constructor of Form2. In Form 2, I have another 2 lists that gets the copy from lists that have been sent by Form 1.

List<string> SongList = new List<string>();
        List<string> PathList = new List<string>();
        public frmPlayList(List<string> a, List<string> b)
            SongList = a;
            PathList = b;
Now, if I made any changes to the lists present in Form2 (SongList and PathList).
My question is, if the other lists of Form 1 (that was sent to Form2) will be modified or not??
Posted 29-Oct-11 11:57am
Edited 29-Oct-11 14:27pm
Amir Mahfoozi 30-Oct-11 3:11am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Unless you reset the reference, it's the same object. So yes, any changes (adding, removing objects) you make are done on the original list objects.
SAKryukov 29-Oct-11 22:04pm
Correct, a 5.
Nishant Sivakumar 31-Oct-11 7:33am
Espen Harlinn 30-Oct-11 9:14am
Nishant Sivakumar 31-Oct-11 7:33am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 29 Oct 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100