System.Attribute.GetCustomAttribute C# (CSharp) Method

GetCustomAttribute() public static method

public static GetCustomAttribute ( Assembly element, Type attributeType ) : Attribute
element Assembly
attributeType Type
return Attribute
        public static Attribute GetCustomAttribute(Assembly element, Type attributeType)
        {
            return GetCustomAttribute (element, attributeType, true);
        }

Same methods

Attribute::GetCustomAttribute ( Assembly element, Type attributeType, bool inherit ) : Attribute
Attribute::GetCustomAttribute ( MemberInfo element, Type attributeType ) : Attribute
Attribute::GetCustomAttribute ( MemberInfo element, Type attributeType, bool inherit ) : Attribute
Attribute::GetCustomAttribute ( Module element, Type attributeType ) : Attribute
Attribute::GetCustomAttribute ( Module element, Type attributeType, bool inherit ) : Attribute
Attribute::GetCustomAttribute ( ParameterInfo element, Type attributeType ) : Attribute
Attribute::GetCustomAttribute ( ParameterInfo element, Type attributeType, bool inherit ) : Attribute

Usage Example

Beispiel #1
0
        /// <summary>
        ///  This method is called by Inventor when it loads the addin.
        ///  The AddInSiteObject provides access to the Inventor Application object.
        ///  The FirstTime flag indicates if the addin is loaded for the first time.
        /// </summary>
        /// <param name="addInSiteObject"></param>
        /// <param name="firstTime"></param>
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            try
            {
                InventorApplication = addInSiteObject.Application;

                //retrieve the GUID for this class and assign it to the string member variable
                //intended to hold it
                GuidAttribute addInClsid = (GuidAttribute)Attribute.GetCustomAttribute
                                               (typeof(StandardAddInServer), typeof(GuidAttribute));
                string addInClsidString = "{" + addInClsid.Value + "}";
                AddInServerId = addInClsidString;

                //Set a reference to the user interface manager to determine the interface style
                UserInterfaceManager userInterfaceManager = InventorApplication.UserInterfaceManager;
                InterfaceStyleEnum   interfaceStyle       = userInterfaceManager.InterfaceStyle;

                RectangleDependencyManager = new RectangleToolsDependencyMapper();

                if (interfaceStyle == InterfaceStyleEnum.kRibbonInterface)
                {
                    if (firstTime == true)
                    {
                        RectangleDependencyManager.InitializeUserInterface();
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
All Usage Examples Of System.Attribute::GetCustomAttribute