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());
        }
        public void SetTimeZone(TimeZoneFromTwitter timeZoneFromTwitter)
        {
            var tzinfo = timeZoneFromTwitter.GetTZinfo();

            if (tzinfo != null)
            {
                TimeZone = tzinfo;
            }
        }
        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 GetDisplayableValue(this TimeZoneFromTwitter timeZoneFromTwitter)
        {
            var twitterTimeZoneAttribute = GetAttribute(timeZoneFromTwitter);

            return(twitterTimeZoneAttribute != null ? twitterTimeZoneAttribute.DisplayValue : timeZoneFromTwitter.ToString());
        }
        public static string GetTZinfo(this TimeZoneFromTwitter timeZoneFromTwitter)
        {
            var twitterTimeZoneAttribute = GetAttribute(timeZoneFromTwitter);

            return(twitterTimeZoneAttribute != null ? twitterTimeZoneAttribute.TZinfo : null);
        }
Пример #6
0
 public void SetTimeZone(TimeZoneFromTwitter timeZoneFromTwitter)
 {
     var tzinfo = timeZoneFromTwitter.GetTZinfo();
     if (tzinfo != null)
     {
         TimeZone = tzinfo;
     }
 }
Пример #7
0
        private static TimeZoneFromTwitterAttribute GetAttribute(TimeZoneFromTwitter timeZoneFromTwitter)
        {
            var field = timeZoneFromTwitter.GetType().GetField(timeZoneFromTwitter.ToString());

            return (TimeZoneFromTwitterAttribute)CustomAttributeExtensions.GetCustomAttribute(field, typeof(TimeZoneFromTwitterAttribute));
        }
Пример #8
0
        private static TimeZoneFromTwitterAttribute GetAttribute(TimeZoneFromTwitter timeZoneFromTwitter)
        {
            var field = timeZoneFromTwitter.GetType().GetField(timeZoneFromTwitter.ToString());

            return((TimeZoneFromTwitterAttribute)Attribute.GetCustomAttribute(field, typeof(TimeZoneFromTwitterAttribute)));
        }