using System;
using System.Reflection;
class Program {
static void Main() {
Type type = Type.GetTypeFromProgID("COMComponent1.CCOMClass");
// We could also wite:
// Type type = Type.GetTypeFromCLSID(
// new System.Guid("1E3B6413-7E63-42B5-874D-E0A27A42190C"));
Object obj = Activator.CreateInstance( type );
Object[] args = new Object[] { 3, 4 };
int retVal = (int) type.InvokeMember(
"CalcSum",
BindingFlags.InvokeMethod,
null,
obj,
args);
Console.WriteLine(retVal);
}
}