Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
I have an object(objcust) which has base object/class and again some inner object/class
I want to set value of an attribute(MobileNo) which is inside the class/object (ContactDetails) of base class
I am using this syntax but giving error :
objcust.GetType().BaseType.GetProperty("MobileNo").SetValue(objcust,"8981511652", null);

can any1 come up with proper solution
thanks in advance !!
Posted
Updated 27-Feb-14 0:39am
v3
Comments
Sergey Alexandrovich Kryukov 27-Feb-14 12:10pm    
What do you mean by "attribute", exactly. If this is a .NET attribute, it cannot and never need to be modified.
If this is a property, this is easy. What's wrong in your code (it's bad, but what's wrong?)? What error? It might work (or not, it depends), but the idea is bad, so it would be good if you explain the purpose.
And — no need to get base type.
Can you show the type definition? Such things are pretty easy...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900