|
I have a dictionary< string, object >. The object values can either be a string or another dictionary. If it's a string, it will be used to move through a switch statement. If it is a dictionary, an if statement that checks for the dictionary type will cause an early return before the switch and essentially load said dictionary as the current dictionary. When my game was JavaScript, I could check if( myDictionary.TypeOf() == Dictionary.< string, object > ){...} But in C# that syntax doesn't work (and yeah, I changed the Dictionary<T,T> syntax omitting the period.) I tried if( myDictionary is Dictionary< string, object > ){...} I can see that the variable is of the right type via the console, but it's not satisfying the conditional. So... my question is-- how can I check for the type of the variable that may contain a dictionary... or is there some other strategy I should be considering?
(comments are locked)
|
|
With the typeof operator you get the type-object for a certain class / type. not tested but should work ;) Thanks, that worked out.
Nov 06 '11 at 07:21 PM
Sinaz20
(comments are locked)
|
