When using reflection in C #, you must pass the object [] from the parameters that were later added, I have a gui that allows the user to enter parameter values. I know what type of input they are, expected input, int, string, float, instance of user object, etc. In the case when the argument is an array of some type, int [] foo [], it allows the user to build an array of this type, and add / remove elements.
What I don't know is how I can use this information (I know that the data type is type t.) How can I build the array t [] so that when its value is called, it can convert to array type.
For example, right now, if I have a function that requires an array of integers as an argument, I am currently passing an object [] with another object [] inside it, which is filled with integers, but you cannot just use object [ ] to int [], so the call is not made.
I cannot write a switching case, since it is impossible to predict all possible types (for example, some classes defined in a loaded dll)
source
share