Click here to Skip to main content
16,010,394 members
Home / Discussions / C#
   

C#

 
GeneralRe: bitmap background issue and resources Pin
Christian Graus3-Feb-05 8:41
protectorChristian Graus3-Feb-05 8:41 
GeneralRe: bitmap background issue and resources Pin
Aviv Halperin3-Feb-05 22:57
Aviv Halperin3-Feb-05 22:57 
GeneralODBC Programming Pin
Adnan Siddiqi2-Feb-05 23:45
Adnan Siddiqi2-Feb-05 23:45 
GeneralRe: ODBC Programming Pin
Heath Stewart3-Feb-05 0:17
protectorHeath Stewart3-Feb-05 0:17 
GeneralMulti-monitor Pin
SquallBlade2-Feb-05 23:19
SquallBlade2-Feb-05 23:19 
GeneralRe: Multi-monitor Pin
Heath Stewart2-Feb-05 23:23
protectorHeath Stewart2-Feb-05 23:23 
GeneralTransparent tabcontrol Pin
Member 8094092-Feb-05 22:54
Member 8094092-Feb-05 22:54 
GeneralReflection question Pin
Christian Graus2-Feb-05 18:25
protectorChristian Graus2-Feb-05 18:25 
We have an n tiered app with a class that represents objects in our system, and a lot of the properties for that class are sub entities that we define, and so on. Our client is writing a web service that sends us XML, which we use to update our objects, and we're using an approach where we create lists of properties and use reflection in a central method, so that if I pass in an object of type A, and a string that is "B.C.D.E", and an object that is, for example, set to be true, the reflection code gets the B property of A, then uses the returned object to get the C property and so on, until it has D. Then it works out the type of the object being passed in, converts the XML string to that type, and finally uses reflection to set D.E = true.

This all works pretty well, but we have a property which is indexed by an enum, and values for setting properties for the resultant object, for each of the enum values. So, my input string is something like B.C[MyEnum.D].E and once I have an object of type B, I need to get the object returned by referencing the property C, passing in the enum value of D. Does that make sense ? I hope so. My problem is that I can't figure out how, if I have an object, of type B, and "C", "MyEnum" and "D" as string arguments, I can use reflection to end up with the final property, so I can proceed to set it's E property.

In other words, if I have an object, how do I use reflection to retrieve a property which is indexed by an enum value ?

Thanks for any help.


Christian

I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
GeneralRe: Reflection question Pin
Robert Rohde2-Feb-05 20:15
Robert Rohde2-Feb-05 20:15 
GeneralRe: Reflection question Pin
Christian Graus3-Feb-05 10:09
protectorChristian Graus3-Feb-05 10:09 
GeneralRe: Reflection question Pin
Heath Stewart2-Feb-05 23:19
protectorHeath Stewart2-Feb-05 23:19 
GeneralRe: Reflection question Pin
Christian Graus3-Feb-05 10:08
protectorChristian Graus3-Feb-05 10:08 
GeneralRe: Reflection question Pin
Christian Graus3-Feb-05 11:00
protectorChristian Graus3-Feb-05 11:00 
GeneralRe: Reflection question Pin
Heath Stewart3-Feb-05 11:10
protectorHeath Stewart3-Feb-05 11:10 
GeneralRe: Reflection question Pin
Christian Graus3-Feb-05 11:13
protectorChristian Graus3-Feb-05 11:13 
GeneralComputer name and IP Pin
Luis Alonso Ramos2-Feb-05 16:05
Luis Alonso Ramos2-Feb-05 16:05 
GeneralRe: Computer name and IP Pin
mav.northwind2-Feb-05 22:44
mav.northwind2-Feb-05 22:44 
GeneralRe: Computer name and IP Pin
Luis Alonso Ramos3-Feb-05 5:59
Luis Alonso Ramos3-Feb-05 5:59 
GeneralTreeView Pin
Yulianto.2-Feb-05 15:14
Yulianto.2-Feb-05 15:14 
GeneralRe: TreeView Pin
Luis Alonso Ramos2-Feb-05 16:10
Luis Alonso Ramos2-Feb-05 16:10 
GeneralRe: TreeView Pin
Yulianto.2-Feb-05 17:26
Yulianto.2-Feb-05 17:26 
GeneralImage Insertion problem in RTF code Pin
sachinkalse2-Feb-05 14:53
sachinkalse2-Feb-05 14:53 
GeneralRegistry to xml conversion Pin
Karen242-Feb-05 14:01
Karen242-Feb-05 14:01 
GeneralRe: Registry to xml conversion Pin
Dave Kreskowiak3-Feb-05 5:51
mveDave Kreskowiak3-Feb-05 5:51 
QuestionWhat's the C# v1 way of doing what a C# Nullable type will do in v2? Pin
nevdelap2-Feb-05 13:41
nevdelap2-Feb-05 13:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.