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); }
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); }
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); }