| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| C-Sharp Programming Post questions, answers, and comments about C#. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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; |
|
#2
|
|||
|
|||
|
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.
|
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|