I want to add the properties to the class / object dynamically in c# in VS 3.5. how can i do this?
+1
A:
If you want to create an object that supports run-time addition of properties, and you can use C# 4.0, you can use System.Dynamic.ExpandoObject
dynamic myObject = new ExpandoObject();
myObject.AnswerToUltimateQuestionOfTheUniverse = 42;
EDIT: I see that you have now explictly mentioned C# 3.0. This is no longer applicable.
Ani
2010-08-20 06:29:22
still, in the future this will be relevant. +1 :)
Daren Thomas
2010-08-20 07:15:05
please see again , I have mentioned 3.5 not 3.0. I think we can do this by Dictionary or Hash table but how to achieve exact?
Lalit
2010-08-20 09:13:38
any updates over this?
Lalit
2010-08-20 10:49:22