Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Converting form C# alias type to .NET framework type

Converting form C# alias type to .NET framework type

Scheduled Pinned Locked Moved C#
csharpdotnetcomtutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sharongav
    wrote on last edited by
    #1

    There is an built-in types table for .NET framework type to C# type which are aliases of predefined types in the System namespace (http://msdn2.microsoft.com/en-US/library/ya5y69ds.aspx). How can use access and use this table (by C# code) to convert the alias to the .NET framework type. For example: if I have: string aliasType = "int"; string frameworkType = ??? ------- Thanks Sharon

    A 1 Reply Last reply
    0
    • S sharongav

      There is an built-in types table for .NET framework type to C# type which are aliases of predefined types in the System namespace (http://msdn2.microsoft.com/en-US/library/ya5y69ds.aspx). How can use access and use this table (by C# code) to convert the alias to the .NET framework type. For example: if I have: string aliasType = "int"; string frameworkType = ??? ------- Thanks Sharon

      A Offline
      A Offline
      aamironline
      wrote on last edited by
      #2

      It's a simple, Just create a function, accept c# type, use switch case statements, find and return respective .Net type...

      M Aamir Maniar aamirOnline.com

      S 1 Reply Last reply
      0
      • A aamironline

        It's a simple, Just create a function, accept c# type, use switch case statements, find and return respective .Net type...

        M Aamir Maniar aamirOnline.com

        S Offline
        S Offline
        sharongav
        wrote on last edited by
        #3

        Yes, I can use the switching for the string alias, and I can also use a hard coded hash table. But the .NET has this kind of table built-in, and I wish to use it (I don't like inventing the wheel all over, it's there already). Do you know how can I use this built-in table? ------ Thanks Sharon

        M 1 Reply Last reply
        0
        • S sharongav

          Yes, I can use the switching for the string alias, and I can also use a hard coded hash table. But the .NET has this kind of table built-in, and I wish to use it (I don't like inventing the wheel all over, it's there already). Do you know how can I use this built-in table? ------ Thanks Sharon

          M Offline
          M Offline
          Marc 0
          wrote on last edited by
          #4

          I think it's easier to make a switch yourself than to try to find that table, which doesn't even have to exist (MSIL optimization and stuff).


          "..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.." -- Mark McCormick


          || Fold With Us! || Pensieve || VG.Net ||

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups