F
Frank Pleyer via .NET 247
Hi,
I got the following problem :
I have an defined an Array of different Actions:
public PRootActions[] AllActions = new PRootActions [10];
I got a dynamic method where all Actions or other things like Materials are loaded from a Database to my Actions or Materials Array:
public void All_Db2Cl (Object[] AllData, ref int totalData)
This method is called like this:
PMain.myPArray.All_Db2Cl (AllAction, ref PMain.myPGlobals.totalActions);
Inside this Method I call the Activator.CreateInstance Method to initialize the Array Element:
AllData = Ativator.CreateInstance (null, "PentaEngine.PRootActions");
With this instruction I receive the following error message :
An unhandled exception of type 'System.ArrayTypeMismatchException' occurred in PentaEngine.exe
Additional information: Attempted to store an element of the incorrect type into the array.
When I write this instead everthing runs finde (but I need to take the first option
)
AllData = Ativator.CreateInstance ((AllData.GetType()).GetElementType());
Does anyone have an idea ?
Thank you very much
Frank
I got the following problem :
I have an defined an Array of different Actions:
public PRootActions[] AllActions = new PRootActions [10];
I got a dynamic method where all Actions or other things like Materials are loaded from a Database to my Actions or Materials Array:
public void All_Db2Cl (Object[] AllData, ref int totalData)
This method is called like this:
PMain.myPArray.All_Db2Cl (AllAction, ref PMain.myPGlobals.totalActions);
Inside this Method I call the Activator.CreateInstance Method to initialize the Array Element:
AllData = Ativator.CreateInstance (null, "PentaEngine.PRootActions");
With this instruction I receive the following error message :
An unhandled exception of type 'System.ArrayTypeMismatchException' occurred in PentaEngine.exe
Additional information: Attempted to store an element of the incorrect type into the array.
When I write this instead everthing runs finde (but I need to take the first option

AllData = Ativator.CreateInstance ((AllData.GetType()).GetElementType());
Does anyone have an idea ?
Thank you very much
Frank