Integral Type for Switch ?

  • Thread starter Thread starter bdwise
  • Start date Start date
B

bdwise

I want to do a switch statement on the value returned from getype(),
but the value is not an integral type. Is there a way to do something
besides gettype().ToString() and not use an if statement?
 
Hi,

I have had the same problem, and concluded that you can only use a switch
if you convert the type to a string, like you mentioned.

If you still want to use the readl type, you can use a multi-level if..else
statement.

Bennie Haelen
 
I'm afraid you'll have to stick to the string representation, but I'd
suggest using the FullName property on the returned System.Type instance
instead of ToString() to make the code more readable.
 
Back
Top