title: use derived class object in base class
body: <p>I have a base class which contain helper method, and I have some derived classes which contain some virtual methods. </p>
  
  <p>so, I want to know how can I use the derived class object in the base classes virtual methods?</p>
  
  <p>derived class </p>
  
  <pre><code> class myclass :baseClass
  {
      public string id { get; set; }
  
      public string name { get; set; }
  
  }
  </code></pre>
  
  <p>base class</p>
  
  <pre><code>public abstract class baseClass
  {
  
      public virtual object FromStream()
      {
          string name, type;
  
          List&lt;PropertyInfo&gt; props = new List&lt;PropertyInfo&gt;(typeof(object).GetProperties()); // here I need to use derived class object 
  
          foreach (PropertyInfo prop in props)
          {
              type = prop.PropertyType.ToString();
              name = prop.Name;
  
              Console.WriteLine(name + " as "+ type);
          }
          return null;
      }
  </code></pre>
  
  <p>main </p>
  
  <pre><code> static void Main(string[] args)
      {
          var myclass = new myclass();
          myclass.FromStream(); // the object that I want to use it 
  
          Console.ReadKey();
      }
  </code></pre>