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. type conversion

type conversion

Scheduled Pinned Locked Moved C#
helpquestion
5 Posts 5 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.
  • C Offline
    C Offline
    chakkara2003
    wrote on last edited by
    #1

    how can i convert a system.string to system.type Type ct=null; ct=(Type)Convert.ChangeType("string",typeof(Type)); why the above lines shows error please help me chakkara

    H J L L 4 Replies Last reply
    0
    • C chakkara2003

      how can i convert a system.string to system.type Type ct=null; ct=(Type)Convert.ChangeType("string",typeof(Type)); why the above lines shows error please help me chakkara

      H Offline
      H Offline
      hpetriffer
      wrote on last edited by
      #2

      If you want to know the type use GetType Regards Hansjörg

      1 Reply Last reply
      0
      • C chakkara2003

        how can i convert a system.string to system.type Type ct=null; ct=(Type)Convert.ChangeType("string",typeof(Type)); why the above lines shows error please help me chakkara

        J Offline
        J Offline
        J4amieC
        wrote on last edited by
        #3

        string str = "hello" Type t = str.GetType(); everything derives from Object, which defines the GetType method. So, this also works int i = 10 Type t = i.GetType();

        1 Reply Last reply
        0
        • C chakkara2003

          how can i convert a system.string to system.type Type ct=null; ct=(Type)Convert.ChangeType("string",typeof(Type)); why the above lines shows error please help me chakkara

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          TypeDescriptor.GetConverter()

          xacc.ide-0.1.2.15
          Now with a grid!

          1 Reply Last reply
          0
          • C chakkara2003

            how can i convert a system.string to system.type Type ct=null; ct=(Type)Convert.ChangeType("string",typeof(Type)); why the above lines shows error please help me chakkara

            L Offline
            L Offline
            Le centriste
            wrote on last edited by
            #5

            I assume that you have a string representing a type (like "System.String") and you want the System.Type corresponding to System.String: Type ct = Type.GetType("System.String", true); // True throws an exception if the type is not found. -------- "I say no to drugs, but they don't listen." - Marilyn Manson

            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