public string GetDescription(AdjacentPadTopic value) { Type type = value.GetType(); string name = Enum.GetName(type, value); if (name != null) { FieldInfo field = type.GetField(name); if (field != null) { DescriptionAttribute attr = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute; if (attr != null) { return(attr.Description); } } } return(null); }
public AdjacentPad(string name, AdjacentPadTopic rowTopic, AdjacentPadTopic colTopic) { Name = name; RowTopic = GetDescription(rowTopic); ColTopic = GetDescription(colTopic); }