CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2006
    Posts
    306

    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. #2
    Join Date
    Jul 2006
    Posts
    297

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured