I was thinking I'd have to use the Type class but I wasn't sure how I'd get the 'type' of the class into the array. Thanks Remy!! :icon_smile: I was wondering, would the following situation be possible?
I have an object that can be one of several classes, however only a certain subset of these class are accpetable. I was thinking that the following might be possible:
Type classList = ...
WTTag tag = ...
for (int k = 0; k < classList.Length; k++)
if (tag is classList[k])
I'm not sure I fully understand Ramy; so all my classes have a Type. This Type is unique to a class and is similar to the ClassName.class attribute in Java? Except that a Type is implicately accessed:
Type classType = MyClassName;
The as operator takes an object and determines if it is an instance of a particular class right? If this is the case then based on what you've said, when I stored the 'Type' of a class in the array I don't really store enough information about the class to do an is comparison? That is, in general the following will not work:
Type classType = System.String;
if (hello is classType) ...
I actually get a compile error (in the first line) so I guess that answers my question. Thanks again hey!
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...