Beispiel #1
0
 public static LanguageAttribute GetValue(Type grammarClass)
 {
     object[] attrs = grammarClass.GetCustomAttributes(typeof(LanguageAttribute), true);
     if (attrs != null && attrs.Length > 0)
     {
         LanguageAttribute la = attrs[0] as LanguageAttribute;
         return(la);
     }
     return(null);
 }
Beispiel #2
0
        public static LanguageAttribute GetValue(Type grammarClass)
        {
            var attrs = grammarClass.GetTypeInfo().GetCustomAttributes(typeof(LanguageAttribute), true);

            if (attrs != null && attrs.Count() > 0)
            {
                LanguageAttribute la = attrs.FirstOrDefault() as LanguageAttribute;
                return(la);
            }
            return(null);
        }
Beispiel #3
0
        public static LanguageAttribute GetValue(Type grammarClass)
        {
#if NETSTANDARD
            var attrs = grammarClass.GetTypeInfo().GetCustomAttributes(typeof(LanguageAttribute), true).ToArray();
#else
            object[] attrs = grammarClass.GetCustomAttributes(typeof(LanguageAttribute), true);
#endif
            if (attrs != null && attrs.Length > 0)
            {
                LanguageAttribute la = attrs[0] as LanguageAttribute;
                return(la);
            }
            return(null);
        }