A
am72de
Hi all,
I have to write an editor for Visual Studio. It's one editor for
different kind of Arrays: Button[], TextBox[] and so on.
The intern array is Control[], so I can use it for all of the
inherited controls.
But now I don't know how to convert a Control[] back to the given
type.
Please see the following example:
Button[] btns = new Button[30];
Control[] ctls = (Control[])btns;
The obvious way to cast the ctls back would be:
Button[] btns2 = (Button[])ctls;
Does anybody know how to convert it back with only a given type?
Something like that: Button[] btns3 = ctls as typeof(Button[]);
Thanks in advance
Andy
I have to write an editor for Visual Studio. It's one editor for
different kind of Arrays: Button[], TextBox[] and so on.
The intern array is Control[], so I can use it for all of the
inherited controls.
But now I don't know how to convert a Control[] back to the given
type.
Please see the following example:
Button[] btns = new Button[30];
Control[] ctls = (Control[])btns;
The obvious way to cast the ctls back would be:
Button[] btns2 = (Button[])ctls;
Does anybody know how to convert it back with only a given type?
Something like that: Button[] btns3 = ctls as typeof(Button[]);
Thanks in advance
Andy