Наследование: System.Attribute
Пример #1
0
        private static int GetGUITargetAttrValue(Type klass, string methodName)
        {
            MethodInfo method = klass.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
            bool       flag   = method != null;
            int        result;

            if (flag)
            {
                object[] customAttributes = method.GetCustomAttributes(true);
                bool     flag2            = customAttributes != null;
                if (flag2)
                {
                    for (int i = 0; i < customAttributes.Length; i++)
                    {
                        bool flag3 = customAttributes[i].GetType() != typeof(GUITargetAttribute);
                        if (!flag3)
                        {
                            GUITargetAttribute gUITargetAttribute = customAttributes[i] as GUITargetAttribute;
                            result = gUITargetAttribute.displayMask;
                            return(result);
                        }
                    }
                }
            }
            result = -1;
            return(result);
        }
Пример #2
0
        private static int GetGUITargetAttrValue(Type klass, string methodName)
        {
            MethodInfo method = klass.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

            if (method != null)
            {
                object[] customAttributes = method.GetCustomAttributes(inherit: true);
                if (customAttributes != null)
                {
                    for (int i = 0; i < customAttributes.Length; i++)
                    {
                        if (customAttributes[i].GetType() == typeof(GUITargetAttribute))
                        {
                            GUITargetAttribute gUITargetAttribute = customAttributes[i] as GUITargetAttribute;
                            return(gUITargetAttribute.displayMask);
                        }
                    }
                }
            }
            return(-1);
        }
Пример #3
0
        static int GetGUITargetAttrValue(Type klass, string methodName)
        {
            var method = klass.GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

            if (method != null)
            {
                object[] attrs = method.GetCustomAttributes(true);
                if (attrs != null)
                {
                    for (int i = 0; i < attrs.Length; ++i)
                    {
                        if (attrs[i].GetType() != typeof(GUITargetAttribute))
                        {
                            continue;
                        }

                        GUITargetAttribute attr = attrs[i] as GUITargetAttribute;
                        return(attr.displayMask);
                    }
                }
            }

            return(-1);
        }