public string GetEnumName (string typeName, string xmlName)
{
if (_isFlags) {
xmlName = xmlName.Trim ();
if (xmlName.Length == 0)
return "0";
System.Text.StringBuilder sb = new System.Text.StringBuilder ();
string[] enumNames = xmlName.Split (null);
foreach (string name in enumNames) {
if (name == string.Empty) continue;
string foundEnumValue = null;
for (int i = 0; i < XmlNames.Length; i++)
if (XmlNames[i] == name) {
foundEnumValue = EnumNames[i];
break;
}
if (foundEnumValue != null) {
if (sb.Length > 0)
sb.Append (',');
sb.Append (foundEnumValue);
} else {
throw new InvalidOperationException (string.Format (CultureInfo.CurrentCulture,
"'{0}' is not a valid value for {1}.", name, typeName));
}
}
return sb.ToString ();
}
foreach (EnumMapMember mem in _members)
if (mem.XmlName == xmlName) return mem.EnumName;
return null;
}
}