Listing B – HelloHello
using System.Reflection;
using System;
 
public class HelloHello
{
      public static void Main2()
      {
             HelloHello hello = new HelloHello();
             LateBoundCall((Object) hello,"SaySomething");
             
             //Pause here so we can see the results.
             Console.ReadLine();
      }
      public static void LateBoundCall(Object o, String MethodName)
      {
             Type t = o.GetType();
             //Even though cast to object, o keeps it's "true" type.
             //try a Console.WriteLine(t.Name) here to verify this.
 
             //Create an array to hold the arguments for the method
             String[] args = new String[1];
             args[0] = "Hello World.";
 
             //call the method
             t.InvokeMember(MethodName, BindingFlags.InvokeMethod, Type.DefaultBinder ,o ,args);
 
      }
      public void SaySomething(string Message)
      {
             Console.WriteLine(Message);
      }
}