I have a c# Class
class BaseModel
{
private Dictionary<string, string> _attr;
public string this[string propName]
{
get
{
string strReturnValue = string.Empty;
if (this._attr.ContainsKey(propName))
strReturnValue = this._attr[propName];
return strReturnValue;
}
set
{
if (!this._attr.ContainsKey(propName))
this._attr.Add(propName, value);
else
this._attr[propName] = value;
// Doing something here
}
}
public BaseModel(BaseModel aParent)
{
this._attr = new Dictionary<string, string>();
}
}
Basically I want to perform some code while setting the dictionary through indexer property, I cannot find a way to do this in typescript. Can anyone help me about this requirement.