title: C# - Accessing a list of Objects from one class to another
body: <p>I am having this very strange problem where i am creating a list of some objects in one class then trying to access it in another class but it's coming empty in other class:</p>
  
  <p>My first class where i am populating the list:</p>
  
  <pre><code>namespace dragdrop
  {
      struct BR
      {
          private string var;
          public string Var
          {
              get { return var; }
              set { var = value; }
          }
          private string equalsTo;
  
          public string EqualsTo
          {
              get { return equalsTo; }
              set { equalsTo = value; }
          }
          private string output;
  
          public string Output
          {
              get { return output; }
              set { output = value; }
          }
          private string els;
  
          public string Els
          {
              get { return els; }
              set { els = value; }
          }
          private string elsOutput;
  
          public string ElsOutput
          {
              get { return elsOutput; }
              set { elsOutput = value; }
          }
  
  
  
      }
      public partial class Form1 : Form
      {
      //******************
          private List&lt;BR&gt; list = new List&lt;BR&gt;(); //This is the list!
      //******************
  
          internal List&lt;BR&gt; List
          {
              get { return list; }
              set { list = value; }
          }
  
          public Form1()
          {
              InitializeComponent();
          }
  
          private void Form1_Load(object sender, EventArgs e)
          {
              string[] vars = new string[] { "Name", "Gender", "Age", "Address", "email" };
  
              comboBox1.DataSource = vars;
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              BR b = new BR();
              b.Var = comboBox1.SelectedItem.ToString();
              b.EqualsTo = textBox1.Text;
              b.Output = textBox2.Text;
              list.Add(b);
      //*****************
              textBox1.Text = List.Count.ToString(); //This gives the correct count value!
      //*****************
              //this.Close();
          }
  
      }
  }
  </code></pre>
  
  <p>I am accessing it in second class like:</p>
  
  <pre><code>namespace dragdrop
  {
      public partial class Ribbon1
      {
          private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
          {
  
          }
  
          private void button1_Click(object sender, RibbonControlEventArgs e)
          {
              Form1 form = new Form1();
              List&lt;BR&gt; l = form.List; ;         
              //*******************
              MessageBox.Show(form.List.Count.ToString()); //This strangely gives count 0!
              //*******************
          }
  
      }
  }
  </code></pre>
  
  <p>I have even tried making everything public in first class but no matter what i do, im always getting empty list in second class.</p>