我正在尝试以下代码:
public partial class Test: Window
{
public Test(ref List</* Type */> LList)
{
[...]
this.ListField = LList;
}
private List</* Type */> ListField;
}
C# 不在“ListField”中保存引用。例子:
Test test = new Test(ref /* List</* Type */>-variable*/)
---------
public partial class Test: Window
{
public Test(ref List</* Type */> LList)
{
[...]
this.ListField = LList;
}
private List</* Type */> ListField;
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
ListField = null;
}
}
关闭表单后,给予的对象public Test(ref List</* Type */> LList)
没有改变(它不是“空”)。
那么如何在“ListField”中保存引用?