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. Reflections

Reflections

Scheduled Pinned Locked Moved C#
questionhelptutorial
2 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.
  • P Offline
    P Offline
    ParagGupta
    wrote on last edited by
    #1

    How to get the values of some properties in the class Like I have a Class ... Class1 in which some properties are defined say FName, LName.. What I want is that I want to apply this thing to many classes of which I don't know the properties that it contains as in.... in class1 it may be FName or LName but what is in class 2 I don't know I want to have some common code that will apply for all the classes I want. the problem with this one is that here I have to call the values of all the properties individually How can I do this? Please reply. Thanks in Advance Parag Gupta

    N 1 Reply Last reply
    0
    • P ParagGupta

      How to get the values of some properties in the class Like I have a Class ... Class1 in which some properties are defined say FName, LName.. What I want is that I want to apply this thing to many classes of which I don't know the properties that it contains as in.... in class1 it may be FName or LName but what is in class 2 I don't know I want to have some common code that will apply for all the classes I want. the problem with this one is that here I have to call the values of all the properties individually How can I do this? Please reply. Thanks in Advance Parag Gupta

      N Offline
      N Offline
      Nader Elshehabi
      wrote on last edited by
      #2

      Hello I don't think I fully understand your question, but if you want to browse through all properties of a certain type -not instance- and get their names then call Type.GetProperties() method. If you have a certain object of that type, and you want to check the value of that property, then get the PropertyInfo and call PropertyInfo.GetValue() method supplying it with the object you want to check for that value. I hope this was helpful.

      Regards:rose:

      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