关于C#清单的问题 [英] Question about C# List
本文介绍了关于C#清单的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两种形式.两种形式,我都有两个字符串列表.通过调用Form2的构造函数,我从FORM 1发送了两个列表到FORM 2.在表单2中,我还有另外两个列表,这些列表从表单1发送的列表中获取副本.
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)
{
InitializeComponent();
SongList = a;
PathList = b;
}
现在,如果我对Form2中存在的列表(SongList和PathList)进行了任何更改.
我的问题是,是否将修改发送到Form2的Form 1的其他列表?
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??
推荐答案
除非您重置引用,否则它是?是同一个对象.因此,可以,您对原始列表对象所做的任何更改(添加,删除对象).
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.
这篇关于关于C#清单的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文