title: How to return different class object depending on some condition?
body: <p>I have method where I create class object depending on some condition and want to return only that object which satisfies the condition. In the return method I need to call that object's class method</p>
  
  <p>I can do with <code>object</code>, <code>dynamic</code>, or <code>Tuple</code> but how can we do with reflection or some other method to return only one object?</p>
  
  <pre class="lang-cs prettyprint-override"><code>public dynamic GetInvokeType(string id)
  {
      log.Info("GetInvokeType(): " + id);
  
      if (id.ToLower() == "cm")
      {
          BCMSDashboardManager b = new BCMSDashboardManager();
          return b;
  
      }
      else
      {
          SIPManager s = new SIPManager();                
          return s;
  
      }
  }
  </code></pre>
  
  <p>In the returned method, I will be calling its method based on the returned class object. So, I want to return only one object, not in <code>Tuple</code>, <code>object</code>, or <code>dynamic</code> type.</p>