Invoking loaded types
-
Hi, I have managed to get my program to load types successfully, but when it comes to try and invoke a method that they support i get a compile error. Exception of type System.InvalidCastException was thrown. The type array has been filled using this short code. if(null != type.GetInterface(typeof(IPlugable).FullName)) { Console.WriteLine("Loaded"); loadedTypes[idx++] = type; } This is the code which doesnt work. Anyone have a dime of an idea ? public void LoadTypes(Type[] types) { IPlugable yer = (IPlugable)Activator.CreateInstance(plugins[x]); yer.AFuntion(); }
-
Hi, I have managed to get my program to load types successfully, but when it comes to try and invoke a method that they support i get a compile error. Exception of type System.InvalidCastException was thrown. The type array has been filled using this short code. if(null != type.GetInterface(typeof(IPlugable).FullName)) { Console.WriteLine("Loaded"); loadedTypes[idx++] = type; } This is the code which doesnt work. Anyone have a dime of an idea ? public void LoadTypes(Type[] types) { IPlugable yer = (IPlugable)Activator.CreateInstance(plugins[x]); yer.AFuntion(); }
is the array thats filled in the first block of code? Perhaps if you posted more code something will pop out. James Sonork ID: 100.11138 - Hasaki "Not be to confused with 'The VD Project'. Which would be a very bad pr0n flick. :-D" - Michael P Butler Jan. 18, 2002