Yes this is be possible below is an example (if this is indeed what you want to do) obviously it seems a little odd using reflection in this manner as when you write the object you'll obviously know the

Yes this is be possible below is an example (if this is indeed what you want to do) obviously it seems a little odd using reflection in this manner as when you write the object you'll obviously know the properties etc. , so I assume you've got some clever reason for using reflection for such a process :-)

The clever reason is that the properties represent field names in a database. It seems that in order to do this before I would tell the object to get the row corresponding to the object from the database and then manually set each property. Now this works fine.. but if I changed the database table at all I had to change the code.

I was hoping to find a way to do this dynamically. I asked about this topic a few months back(before I knew anything about reflection) and I eneded up using Hashtables and ArrayLists to represent my data. But this has become way too obscure.

Ah, I suspected it might have something to do with initiating your object from a database record :-)

I did see something rather cool on codeproject which used Attributes to say which properties should be set from the database, I think it was this on http://www.codeproject.com/cs/database/dal1.asp I only had a glancing look but you might find it useful/interesting

0

Featured Post

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Summary:
Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…

This article introduced a TextBox that supports transparent background.
Introduction
TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…

Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…