C# Programming
11-06-2009, 08:00 PM
Im not sure if this is bad programming or anything of the kind. But I need to be able to save a property of an object without know what the name of the property will be before hand.
I have an object: objUser, object user might have properties name, surname and age.
So I want to be able to say:
objUser.["Name"] = "Philip";
or
string sProperty = "Name";
objUser.[sProperty] = "Philip;
How do I invoke such a string as a property? (if explained correctly)...
Any help would be appreciated.
I have an object: objUser, object user might have properties name, surname and age.
So I want to be able to say:
objUser.["Name"] = "Philip";
or
string sProperty = "Name";
objUser.[sProperty] = "Philip;
How do I invoke such a string as a property? (if explained correctly)...
Any help would be appreciated.