Hi,
I am new to C#, but have been programming in Java for a while. What I want know is a way of creating an Array of a specific type, without knowing which type it is...
In Java you would to this:
public Object[] createArray(Class type, int size) {
return Array.newInstance(type, size);
}
This function can then be used like this:
Component[] componentArray = (Component[])createArray(Component.class, 8);
How can this be done in C#?
Thanks on advance,
Nille.
I am new to C#, but have been programming in Java for a while. What I want know is a way of creating an Array of a specific type, without knowing which type it is...
In Java you would to this:
public Object[] createArray(Class type, int size) {
return Array.newInstance(type, size);
}
This function can then be used like this:
Component[] componentArray = (Component[])createArray(Component.class, 8);
How can this be done in C#?
Thanks on advance,
Nille.