mercredi 28 janvier 2015

Unable to use "Add Range" to copy a list in a Class to another list in other Class


Vote count:

0




public partial class Form1 : Form { public Form1() { InitializeComponent(); } class mylist { public List list1 = new List(); }



class mylist2
{
public List<string> list2 = new List<string> { "aton", "electron" };
public void listconvert()
{
mylist ml = new mylist();
ml.list1.AddRange(list2);
MessageBox.Show("do you kn ow");
}
}


private void button1_Click(object sender, EventArgs e) { mylist2 ml2 = new mylist2(); ml2.listconvert(); mylist ml = new mylist();



for (int i = 0; i < ml.list1.Count; i++)
{
textBox1.AppendText(ml.list1[i].ToString() + "\n");
}
}
}


asked 29 secs ago







Unable to use "Add Range" to copy a list in a Class to another list in other Class

Aucun commentaire:

Enregistrer un commentaire