Albert Van Halen
asked on
Indexed properties on custom class
I have a custom class (ControlPropertiesBase) whith the following fields (see code).
Several other classes (derived from WebControls) have the property ControlProperties, which is derived from the ControlPropertiesBase, plus other properties / fields.
Is it possible to access the properties via indexing like myControl.Properties["TabO rder"], and if so how can I do that?
Several other classes (derived from WebControls) have the property ControlProperties, which is derived from the ControlPropertiesBase, plus other properties / fields.
Is it possible to access the properties via indexing like myControl.Properties["TabO
[Serializable]
public class ControlPropertiesBase
{
public string Name;
public string Label;
public string LabelTranslated;
public int TabOrder;
public bool Compulsary;
public bool ReadOnly;
public bool Visible;
}
public class DropDownListControl : DropDownList
{
[Serializable]
public class ControlProperties : ControlPropertiesBase
{
public ControlProperties() { }
public Hashtable Items;
}
private ControlProperties _properties = new ControlProperties();
public ControlProperties Properties
{
get { return _properties; }
set { _properties = value; }
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this._properties = new ControlProperties();
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window