private static TimeZoneFromTwitterAttribute GetAttribute(TimeZoneFromTwitter timeZoneFromTwitter) { #if NET_CORE var field = timeZoneFromTwitter.GetType().GetField(timeZoneFromTwitter.ToString()); return((TimeZoneFromTwitterAttribute)CustomAttributeExtensions.GetCustomAttribute(field, typeof(TimeZoneFromTwitterAttribute))); #else var field = timeZoneFromTwitter.GetType().GetField(timeZoneFromTwitter.ToString()); return((TimeZoneFromTwitterAttribute)Attribute.GetCustomAttribute(field, typeof(TimeZoneFromTwitterAttribute))); #endif }
public static string ToTZinfo(this TimeZoneFromTwitter language) { var field = language.GetType().GetField(language.ToString()); var descriptionAttribute = (TimeZoneFromTwitterAttribute)CustomAttributeExtensions.GetCustomAttribute(field, typeof(TimeZoneFromTwitterAttribute)); return(descriptionAttribute != null ? descriptionAttribute.TZinfo : language.ToString()); }
private static TimeZoneFromTwitterAttribute GetAttribute(TimeZoneFromTwitter timeZoneFromTwitter) { var field = timeZoneFromTwitter.GetType().GetField(timeZoneFromTwitter.ToString()); return (TimeZoneFromTwitterAttribute)CustomAttributeExtensions.GetCustomAttribute(field, typeof(TimeZoneFromTwitterAttribute)); }
private static TimeZoneFromTwitterAttribute GetAttribute(TimeZoneFromTwitter timeZoneFromTwitter) { var field = timeZoneFromTwitter.GetType().GetField(timeZoneFromTwitter.ToString()); return((TimeZoneFromTwitterAttribute)Attribute.GetCustomAttribute(field, typeof(TimeZoneFromTwitterAttribute))); }