/// <summary> /// Gets the type generator class from an enum element with the <c>ImportExportTypeAttribute</c> set. /// </summary> /// <param name="value">The enum value.</param> /// <returns>The title string.</returns> public static Type GetGeneratorClass(this Enum value) { FieldInfo field; if (GetFieldInfo(value, out field)) { return(null); } ImportExportTypeAttribute attr = Attribute.GetCustomAttribute(field, typeof(ImportExportTypeAttribute)) as ImportExportTypeAttribute; return(attr?.GeneratorClass); }
/// <summary> /// Gets the title string from an enum element with the <c>ImportExportTypeAttribute</c> set. /// </summary> /// <param name="value">The enum value.</param> /// <returns>The title string.</returns> public static string GetTitle(this Enum value) { FieldInfo field; if (GetFieldInfo(value, out field)) { return(null); } ImportExportTypeAttribute attr = Attribute.GetCustomAttribute(field, typeof(ImportExportTypeAttribute)) as ImportExportTypeAttribute; return(attr?.Title); }