public static AssetListType GetTypeByName(string shortName)
{
if (String.IsNullOrEmpty(shortName)) return AssetListType.Undefined;
shortName = shortName.ToUpperInvariant();
foreach (FieldInfo field in typeof(AssetListType).GetFields())
{
object[] attributes = field.GetCustomAttributes(typeof(ShortNameAttribute), false);
foreach (ShortNameAttribute shortNameAttribute in attributes)
{
if (String.CompareOrdinal(shortName, shortNameAttribute.Name.ToUpperInvariant()) == 0)
return (AssetListType) field.GetValue(null);
}
if (String.CompareOrdinal(shortName, field.Name.ToUpperInvariant()) == 0)
return (AssetListType)field.GetValue(null);
}
return AssetListType.Undefined;
}