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 property handling?

Type property handling?

Scheduled Pinned Locked Moved C#
question
3 Posts 2 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.
  • M Offline
    M Offline
    mike montagne
    wrote on last edited by
    #1

    I'm thinking ahead, and wonder if anyone knows how a Type property is handled by its designers/typeconverters (if any)? What I'm hoping is that the designers/typeconverters for a Type property will allow entering the String class name of the type, and translate that to an underlying type field, f_MyType:

              protected internal Type f_MyType = null;
    
              // CAN WE INPUT THE String CLASS NAME TO THIS PROPERTY?
              public Type MyType
                   {
                   get
                        {
                        return f_MyType;
                        }
                   set
                        {
                        f_MyType = value;
                        }
                   }
    

    TIA, mike

    B 2 Replies Last reply
    0
    • M mike montagne

      I'm thinking ahead, and wonder if anyone knows how a Type property is handled by its designers/typeconverters (if any)? What I'm hoping is that the designers/typeconverters for a Type property will allow entering the String class name of the type, and translate that to an underlying type field, f_MyType:

                protected internal Type f_MyType = null;
      
                // CAN WE INPUT THE String CLASS NAME TO THIS PROPERTY?
                public Type MyType
                     {
                     get
                          {
                          return f_MyType;
                          }
                     set
                          {
                          f_MyType = value;
                          }
                     }
      

      TIA, mike

      B Offline
      B Offline
      BoneSoft
      wrote on last edited by
      #2

      Never tried it. I would suggest trying it real quick with a PropertyGrid. If it doesn't work, it shouldn't be too tough to write a custom type converter for that. I'm guessing it won't work, but shouldn't take much to test that.


      Try code model generation tools at BoneSoft.com.

      1 Reply Last reply
      0
      • M mike montagne

        I'm thinking ahead, and wonder if anyone knows how a Type property is handled by its designers/typeconverters (if any)? What I'm hoping is that the designers/typeconverters for a Type property will allow entering the String class name of the type, and translate that to an underlying type field, f_MyType:

                  protected internal Type f_MyType = null;
        
                  // CAN WE INPUT THE String CLASS NAME TO THIS PROPERTY?
                  public Type MyType
                       {
                       get
                            {
                            return f_MyType;
                            }
                       set
                            {
                            f_MyType = value;
                            }
                       }
        

        TIA, mike

        B Offline
        B Offline
        BoneSoft
        wrote on last edited by
        #3

        Actually, I'd be tempted to write a type converter and maybe a UITypeEditor implementation that shows possible types to choose from.


        Try code model generation tools at BoneSoft.com.

        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