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. Get value using the name of property

Get value using the name of property

Scheduled Pinned Locked Moved C#
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.
  • U Offline
    U Offline
    Utku KAYA
    wrote on last edited by
    #1

    Hi all, How should I mimic the ComboBox DisplayMember property which gets a string and can use the property whose name is indicated by that string. Thanks in advance

    W 1 Reply Last reply
    0
    • U Utku KAYA

      Hi all, How should I mimic the ComboBox DisplayMember property which gets a string and can use the property whose name is indicated by that string. Thanks in advance

      W Offline
      W Offline
      Wizard_01
      wrote on last edited by
      #2

      When you know the name of the property, you can invoke that using Reflection (System.Reflection) Type.GetType("MyType").GetProperty("MyProperty").GetValue

      U 1 Reply Last reply
      0
      • W Wizard_01

        When you know the name of the property, you can invoke that using Reflection (System.Reflection) Type.GetType("MyType").GetProperty("MyProperty").GetValue

        U Offline
        U Offline
        Utku KAYA
        wrote on last edited by
        #3

        I am buIlding a library for developers so I dont know the type of the object. And another problem , in GetValue Method there is an object and an array of indexes that I couldnt give a meaning. Could you give me a real example please.

        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