-
Type Conversion Help
Okay, I want to know if you can do something like this, I have a parser and I'm trying to have less and less switch blocks and/or repetitive code.
So something like this. It errors out but can I do something similar?
Code:
object i = 5;
int j = 6;
(i.GetType())i += j;
-
Re: Type Conversion Help
Short answer is no. You cannot dynamically cast an object from a System.Type object. Now maybe if you can show us a sample of your switch blocks and/or repetitive code we can try to find another solution.