public GetProperty ( string name, bool &found ) : object | ||
name | string | |
found | bool | |
Результат | object |
public override object GetProperty(string name, out bool found)
{
var val = base.GetProperty(name, out found);
if (!found)
{
switch (name)
{
case AllowMultipleName:
val = AllowMultiple.HasValue ? (AllowMultiple.Value ? 1 : 0) : 0;
found = true;
break;
case AllowExtraValueName:
val = AllowExtraValue.HasValue ? (AllowExtraValue.Value ? 1 : 0) : 0;
found = true;
break;
case OptionsName:
if (_options != null && _options.Count > 0)
{
var sw = new StringWriter();
var ws = new XmlWriterSettings
{
OmitXmlDeclaration = true,
ConformanceLevel = ConformanceLevel.Fragment
};
using (var writer = XmlWriter.Create(sw, ws))
{
writer.WriteStartElement(OptionsName);
foreach (var option in this._options)
{
option.WriteXml(writer);
}
writer.WriteEndElement();
}
val = sw.ToString();
}
found = true;
break;
case DisplayChoicesName:
found = true;
if (_displayChoice.HasValue)
val =(int)_displayChoice.Value;
break;
}
}
return found ? val : null;
}