I have a control ... any System.Windows.Forms.Control . let's say for example. label.
I want to find the default value for its property called Enabled (maybe any property, for that matter). How to do it?
1) See in this case we have a label. The default value for the Enabled label is true.
2) Now, at runtime, suppose I want to know what is the default value for the Enabled property ... how do I know?
3) To begin with, I have an object of my control. From this object I can get the current value for the "Enabled" property, but not the DEFAULT value.
One possible approach to this issue could be:
1) Determine the type of control at run time. 2) Initialize it using your default constructor. 3) Find the value of the object of interest to us (this will, apparently, be the default value), and there ... we have the default value.
But in this case ... I do not know my control before hand. All I know is that it can be any control from System.Windows.Forms.Control . So how do I even initialize it and get its object? Is it possible?
Do you have an alternative solution / better approach?
source
share