Hi guys,
I'm dynamically loading a dll that I've written at runtime but for some reason I'm struggling to get the generics working. I keep getting the following error:
Cannot create an instance of XmlPlugin.XmlPlugin`1[T] because Type.ContainsGenericParameters is true
Heres the code that's in the DLL that I'm trying to load..
[Plugin(PluginType.Storage)]
public class XmlPlugin<T> : IStoragePlugin<T>
{
#region IPlugin Members
public string Name
{
get { return "Xml Plugin"; }
}
public string Version
{
get { return "0.0.0.1"; }
}
public string Author
{
get { return "John Rudd"; }
}
#endregion
public void write(T obj)
{
Console.Write(obj);
}
public string getSupportedTypes()
{
return "Xml|*.xml";
}
public string iconKey
{
get { return "PluginDemo.Resources.dll.bmp"; }
}
public T Read()
{
return (T)new Object();
}
}
Now here's the code that I'm using to load the dll..
if (pt == PluginType.Storage)
{
object o = Activator.CreateInstance(PluginClass, 2) ;
}
Any help would be greatly appreciated.