title: Getting value from IEnumerable collection
body: <p>There are some problems here:</p>
  
  <p>1) Firstly, I've a property in Class1</p>
  
  <pre><code>class Class1
  {
      IEnumerable itemSource;
  
      public IEnumerable ItemSource
      {
          set { itemSource = value; }
          get { return itemSource; }
      }
  }
  </code></pre>
  
  <p>2) a class named <code>TempClass</code></p>
  
  <pre><code>public class TempClass
  {
      int a;
      public int A
      {
          set { a = value; }
          get { return a; }
      }
  
      public TempClass() { }
      public TempClass(int t) { A = t; }
  }
  </code></pre>
  
  <p>3) In <code>static void Main(string[] args)</code>, I tried to this:</p>
  
  <pre><code>ObservableCollection&lt;TempClass&gt; test = new ObservableCollection&lt;TempClass&gt;
  {
      new TempClass(1),
      new TempClass(2),
      new TempClass(3)
  }
  
  Class1 class1 = new Class1();
  class1.ItemSource = test;
  
  foreach (var item in class1.ItemSource)
  {
      Console.WriteLine(item);
  }
  </code></pre>
  
  <p>4) Then, the console shows this:</p>
  
  <pre><code>testSolution.TempClass
  testSolution.TempClass
  testSolution.TempClass
  </code></pre>
  
  <p>where <code>testSolution</code> is my solution name, so is a name of the namespace.</p>
  
  <p>I want to get values: 1, 2, 3.</p>
  
  <p>Here, what I want to make is a property and method that show values of any collection or list of any class type.  </p>
  
  <p>In this case, ItemSource property and method that has:</p>
  
  <pre><code>foreach (var item in class1.ItemSource)
  {
      Console.WriteLine(item);
  }
  </code></pre>
  
  <p>How to do it?</p>