namespace SampleInterface // Class Library { public interface IMethodExec { void TestMethod(); } } namespace ProjectB // Class Library configured for COM+ { public class ClassB : IMethodExec { public void TestMethod() { //business logic goes here – uses external dll } } } namespace ProjectA // Windows application { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { IMethodExec exec = null; Type type = Type.GetTypeFromProgID("ProjectB.ClassB"); exec = Activator.CreateInstance(type) as IMethodExec; exec.TestMethod(); } } } namespace EntApp //Class Library configured for COM+ { public class Exec { IMethodExec exec = null; Type type = Type.GetTypeFromProgID("ProjectB.ClassB"); exec = Activator.CreateInstance(type) as IMethodExec; exec.TestMethod(); } }
Quote:This method is provided for COM support. ProgIDs are not used in the Microsoft .NET Framework because they have been superseded by the concept of namespace.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)