Brug af dynamisk loadning af dll
Jeg kan ikke ændre et indlæst objekt i en Arraylist:Kunne forkortes men for læsbarheden så...
Assembly ass = null;
ass = Assembly.LoadFrom(FileName);
//Only one object is present
foreach (Type plugintype in ass.GetTypes())
{
Type typeinterface = plugintype.GetInterface
("UML_Interface_Shape.IPluginShape", true);
//Check to see if the interface exist
if(typeinterface != null)
{
IPluginShape shape = (IPluginShape)Activator.CreateInstance
(ass.GetType(plugintype.ToString()));
MyAL.Add(shape);
}
}
Dette går fint men her går det galt jeg kan ikke ændre mit objekt jeg hiver ud!!
Graphics g = drawPanel.CreateGraphics();
IPluginShape shape;
shape = (IPluginShape)Global.loader.MyAL[0];
Point p = new Point(20,20);
shape.PosStart = p;
shape.Draw(g);
Hvorfor kan jeg ikke ændre objektet, samt kalde min tegne rutine
