MethodBuilder.GetCustomAttributes 方法
定义
返回为此方法定义的自定义属性。Returns the custom attributes defined for this method.
重载
| GetCustomAttributes(Boolean) |
返回为此方法定义的所有自定义属性。Returns all the custom attributes defined for this method. |
| GetCustomAttributes(Type, Boolean) |
返回由给定类型标识的自定义属性。Returns the custom attributes identified by the given type. |
GetCustomAttributes(Boolean)
返回为此方法定义的所有自定义属性。Returns all the custom attributes defined for this method.
public:
override cli::array <System::Object ^> ^ GetCustomAttributes(bool inherit);
public override object[] GetCustomAttributes (bool inherit);
override this.GetCustomAttributes : bool -> obj[]
Public Overrides Function GetCustomAttributes (inherit As Boolean) As Object()
参数
- inherit
- Boolean
指定是否搜索此成员的继承链以查找自定义属性。Specifies whether to search this member's inheritance chain to find the custom attributes.
返回
- Object[]
返回一个对象数组,其中的对象表示此方法的所有自定义属性。Returns an array of objects representing all the custom attributes of this method.
例外
目前尚不支持此方法。This method is not currently supported. 使用 GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 检索此方法,并在返回的 MethodInfo 上调用 GetCustomAttributes(Boolean)。Retrieve the method using GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) and call GetCustomAttributes(Boolean) on the returned MethodInfo.
适用于
GetCustomAttributes(Type, Boolean)
返回由给定类型标识的自定义属性。Returns the custom attributes identified by the given type.
public:
override cli::array <System::Object ^> ^ GetCustomAttributes(Type ^ attributeType, bool inherit);
public override object[] GetCustomAttributes (Type attributeType, bool inherit);
override this.GetCustomAttributes : Type * bool -> obj[]
Public Overrides Function GetCustomAttributes (attributeType As Type, inherit As Boolean) As Object()
参数
- attributeType
- Type
自定义属性类型。The custom attribute type.
- inherit
- Boolean
指定是否搜索此成员的继承链以查找自定义属性。Specifies whether to search this member's inheritance chain to find the custom attributes.
返回
- Object[]
返回一个对象数组,表示此方法的属性属于类型 attributeType。Returns an array of objects representing the attributes of this method that are of type attributeType.
例外
目前尚不支持此方法。This method is not currently supported. 使用 GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) 检索此方法,并在返回的 MethodInfo 上调用 GetCustomAttributes(Boolean)。Retrieve the method using GetMethod(String, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) and call GetCustomAttributes(Boolean) on the returned MethodInfo.