G
Guest
Hi all
I have read the posting of Chris Bamford, but I still get the problem...
Here are some pieces of code
file IPlugin.cs
public interface IPlugi
string SayHi()
file Class1.c
public class Class1: IPlugi
string IPlugin.SayHi(
return "Hi"
These excerpts are compiled into test.dll
file form1.c
Assembly cAssembly = Assembly.LoadFrom(@"C:\test.dll")
foreach(Type cType in cAssembly.GetTypes()
if(cType.IsClass
if(cType.GetInterface("IPlugin") != null
test.IPlugin Plugin = (test.IPlugin)Activator.CreateInstance(cType)
textBox1.Text = Plugin.SayHi()
Can anybody tell me why I keep getting a System.InvalidCastException in
test.IPlugin Plugin = (test.IPlugin)Activator.CreateInstance(cType)
??
Thanx in advance
Hans
I have read the posting of Chris Bamford, but I still get the problem...
Here are some pieces of code
file IPlugin.cs
public interface IPlugi
string SayHi()
file Class1.c
public class Class1: IPlugi
string IPlugin.SayHi(
return "Hi"
These excerpts are compiled into test.dll
file form1.c
Assembly cAssembly = Assembly.LoadFrom(@"C:\test.dll")
foreach(Type cType in cAssembly.GetTypes()
if(cType.IsClass
if(cType.GetInterface("IPlugin") != null
test.IPlugin Plugin = (test.IPlugin)Activator.CreateInstance(cType)
textBox1.Text = Plugin.SayHi()
Can anybody tell me why I keep getting a System.InvalidCastException in
test.IPlugin Plugin = (test.IPlugin)Activator.CreateInstance(cType)
??
Thanx in advance
Hans