title: Dynamically calling method and class name
body: <p>I have some cases where I have to call method names from class names.</p>
  
  <pre><code>string scenario1 = "MockScenario1";
  string scenario2 = "MockScenario2";
  
  MockScenario1.GetInfo();
  MockScenario2.GetInfo();
  </code></pre>
  
  <p>How can I dynamically use the strings to call method name here like</p>
  
  <pre><code>scenario1.GetInfo()
  scenario2.GetInfo()
  </code></pre>
  
  <p>I tried to find out all options by string and control space to find related options. Any suggestions?</p>
  
  <p>I am tried the below and trying to Get class name generated dynamically</p>
  
  <p>The below code generated method name dynamically</p>
  
  <pre><code>string methodName = "hello";
  
  //Get the method information using the method info class
   MethodInfo mi = this.GetType().GetMethod(methodName);
  
  //Invoke the method
  // (null- no parameter for the method call
  // or you can pass the array of parameters...)
  mi.Invoke(this, null);
  </code></pre>
  
  <p>More clear scenario:
  I am trying to send class name as parameter
  MockScenario1 and MockScenario2 are class names.</p>
  
  <pre><code>string scenarioCats = "MockScenario1";
  string scenarioDogs = "MockScenario2";
  GetResult(scenarioCats);
  GetResult(scenarioDogs);
  
  public static void GetCatsResult(string scenarioCats){
  scenarioCats obj = new scenarioCats();
      obj.GetInfo();    
  }
  public static void GetDogsResult(string scenarioDogs){
  scenarioDogs obj = new scenarioDogs();
      obj.GetInfo();    
  }
  </code></pre>