CustomAttributeBuilder 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 CustomAttributeBuilder 类的实例。
重载
| CustomAttributeBuilder(ConstructorInfo, Object[]) |
在给定了自定义属性的构造函数和构造函数的参数的情况下,初始化 |
| CustomAttributeBuilder(ConstructorInfo, Object[], FieldInfo[], Object[]) |
已知自定义特性的构造函数、该构造函数的参数以及一组命名的字段/值对,初始化 |
| CustomAttributeBuilder(ConstructorInfo, Object[], PropertyInfo[], Object[]) |
已知自定义特性的构造函数、该构造函数的参数以及一组命名的属性/值对,初始化 |
| CustomAttributeBuilder(ConstructorInfo, Object[], PropertyInfo[], Object[], FieldInfo[], Object[]) |
已知自定义特性的构造函数、该构造函数的参数、一组命名的属性/值对以及一组命名的字段/值对,初始化 |
CustomAttributeBuilder(ConstructorInfo, Object[])
- Source:
- CustomAttributeBuilder.cs
- Source:
- CustomAttributeBuilder.cs
- Source:
- CustomAttributeBuilder.cs
在给定了自定义属性的构造函数和构造函数的参数的情况下,初始化 CustomAttributeBuilder 类的实例。
public:
CustomAttributeBuilder(System::Reflection::ConstructorInfo ^ con, cli::array <System::Object ^> ^ constructorArgs);
public CustomAttributeBuilder (System.Reflection.ConstructorInfo con, object?[] constructorArgs);
public CustomAttributeBuilder (System.Reflection.ConstructorInfo con, object[] constructorArgs);
new System.Reflection.Emit.CustomAttributeBuilder : System.Reflection.ConstructorInfo * obj[] -> System.Reflection.Emit.CustomAttributeBuilder
Public Sub New (con As ConstructorInfo, constructorArgs As Object())
参数
- con
- ConstructorInfo
自定义属性的构造函数。
- constructorArgs
- Object[]
自定义属性的构造函数的参数。
例外
con 为静态或私有。
- 或 -
提供的参数数目与构造函数的调用约定所需的构造函数的参数数目不匹配。
- 或 -
提供的参数类型与构造函数中声明的参数类型不匹配。
- 或 -
con 或 constructorArgs 为 null。
注解
数组的 constructorArgs 元素仅限于元素类型。 它们可以是 byte、、、int、uint、long、ulongcharfloatdoubleString、bool枚举、类型、已强制转换为对象的任何先前类型,或任何先前类型的从零开始的单维数组。 sbyte
适用于
CustomAttributeBuilder(ConstructorInfo, Object[], FieldInfo[], Object[])
- Source:
- CustomAttributeBuilder.cs
- Source:
- CustomAttributeBuilder.cs
- Source:
- CustomAttributeBuilder.cs
已知自定义特性的构造函数、该构造函数的参数以及一组命名的字段/值对,初始化 CustomAttributeBuilder 类的实例。
public:
CustomAttributeBuilder(System::Reflection::ConstructorInfo ^ con, cli::array <System::Object ^> ^ constructorArgs, cli::array <System::Reflection::FieldInfo ^> ^ namedFields, cli::array <System::Object ^> ^ fieldValues);
public CustomAttributeBuilder (System.Reflection.ConstructorInfo con, object?[] constructorArgs, System.Reflection.FieldInfo[] namedFields, object?[] fieldValues);
public CustomAttributeBuilder (System.Reflection.ConstructorInfo con, object[] constructorArgs, System.Reflection.FieldInfo[] namedFields, object[] fieldValues);
public CustomAttributeBuilder (System.Reflection.ConstructorInfo con, object?[] constructorArgs, System.Reflection.FieldInfo[] namedFields, object[] fieldValues);
new System.Reflection.Emit.CustomAttributeBuilder : System.Reflection.ConstructorInfo * obj[] * System.Reflection.FieldInfo[] * obj[] -> System.Reflection.Emit.CustomAttributeBuilder
Public Sub New (con As ConstructorInfo, constructorArgs As Object(), namedFields As FieldInfo(), fieldValues As Object())
参数
- con
- ConstructorInfo
自定义属性的构造函数。
- constructorArgs
- Object[]
自定义属性的构造函数的参数。
- namedFields
- FieldInfo[]
自定义属性的命名字段。
- fieldValues
- Object[]
自定义属性的命名字段的值。
例外
namedFields 和 fieldValues 数组的长度不相同。
- 或 -
con 为静态或私有。
- 或 -
提供的参数数目与构造函数的调用约定所需的构造函数的参数数目不匹配。
- 或 -
提供的参数类型与构造函数中声明的参数类型不匹配。
- 或 -
字段值的类型与命名字段的类型不匹配。
- 或 -
该字段不属于与构造函数相同的类或基类。
- 或 -
其中一个参数为 null。
注解
和 fieldValues 数组的constructorArgs元素仅限于元素类型。 它们可以是 byte、、、int、uint、long、ulongcharfloatdoubleString、bool枚举、类型、已强制转换为对象的任何先前类型,或任何先前类型的从零开始的单维数组。 sbyte
重要
请勿在 中包含 namedFields私有字段。 这样做将导致 CustomAttributeFormatException 稍后对已完成类型调用 方法时 GetCustomAttributes 引发。
适用于
CustomAttributeBuilder(ConstructorInfo, Object[], PropertyInfo[], Object[])
- Source:
- CustomAttributeBuilder.cs
- Source:
- CustomAttributeBuilder.cs
- Source:
- CustomAttributeBuilder.cs
已知自定义特性的构造函数、该构造函数的参数以及一组命名的属性/值对,初始化 CustomAttributeBuilder 类的实例。
public:
CustomAttributeBuilder(System::Reflection::ConstructorInfo ^ con, cli::array <System::Object ^> ^ constructorArgs, cli::array <System::Reflection::PropertyInfo ^> ^ namedProperties, cli::array <System::Object ^> ^ propertyValues);
public CustomAttributeBuilder (System.Reflection.ConstructorInfo con, object?[] constructorArgs, System.Reflection.PropertyInfo[] namedProperties, object?[] propertyValues);
public CustomAttributeBuilder (System.Reflection.ConstructorInfo con, object[] constructorArgs, System.Reflection.PropertyInfo[] namedProperties, object[] propertyValues);
public CustomAttributeBuilder (System.Reflection.ConstructorInfo con, object?[] constructorArgs, System.Reflection.PropertyInfo[] namedProperties, object[] propertyValues);
new System.Reflection.Emit.CustomAttributeBuilder : System.Reflection.ConstructorInfo * obj[] * System.Reflection.PropertyInfo[] * obj[] -> System.Reflection.Emit.CustomAttributeBuilder
Public Sub New (con As ConstructorInfo, constructorArgs As Object(), namedProperties As PropertyInfo(), propertyValues As Object())
参数
- con
- ConstructorInfo
自定义属性的构造函数。
- constructorArgs
- Object[]
自定义属性的构造函数的参数。
- namedProperties
- PropertyInfo[]
自定义属性 (Attribute) 的命名属性 (Property)。
- propertyValues
- Object[]
自定义属性 (Attribute) 的命名属性 (Property) 的值。
例外
namedProperties 和 propertyValues 数组的长度不相同。
- 或 -
con 为静态或私有。
- 或 -
提供的参数数目与构造函数的调用约定所需的构造函数的参数数目不匹配。
- 或 -
提供的参数类型与构造函数中声明的参数类型不匹配。
- 或 -
属性值的类型与命名属性的类型不匹配。
- 或 -
属性没有 setter 方法。
- 或 -
该属性不属于与构造函数相同的类或基类。
- 或 -
其中一个参数为 null。
注解
和 propertyValues 数组的constructorArgs元素仅限于元素类型。 它们可以是 byte、、、int、uint、long、ulongcharfloatdoubleString、bool枚举、类型、已强制转换为对象的任何先前类型,或任何先前类型的从零开始的单维数组。 sbyte
重要
不要在 中包含 namedProperties私有属性。 这样做将导致 CustomAttributeFormatException 稍后对已完成类型调用 方法时 GetCustomAttributes 引发。
适用于
CustomAttributeBuilder(ConstructorInfo, Object[], PropertyInfo[], Object[], FieldInfo[], Object[])
- Source:
- CustomAttributeBuilder.cs
- Source:
- CustomAttributeBuilder.cs
- Source:
- CustomAttributeBuilder.cs
已知自定义特性的构造函数、该构造函数的参数、一组命名的属性/值对以及一组命名的字段/值对,初始化 CustomAttributeBuilder 类的实例。
public:
CustomAttributeBuilder(System::Reflection::ConstructorInfo ^ con, cli::array <System::Object ^> ^ constructorArgs, cli::array <System::Reflection::PropertyInfo ^> ^ namedProperties, cli::array <System::Object ^> ^ propertyValues, cli::array <System::Reflection::FieldInfo ^> ^ namedFields, cli::array <System::Object ^> ^ fieldValues);
public CustomAttributeBuilder (System.Reflection.ConstructorInfo con, object?[] constructorArgs, System.Reflection.PropertyInfo[] namedProperties, object?[] propertyValues, System.Reflection.FieldInfo[] namedFields, object?[] fieldValues);
public CustomAttributeBuilder (System.Reflection.ConstructorInfo con, object[] constructorArgs, System.Reflection.PropertyInfo[] namedProperties, object[] propertyValues, System.Reflection.FieldInfo[] namedFields, object[] fieldValues);
public CustomAttributeBuilder (System.Reflection.ConstructorInfo con, object?[] constructorArgs, System.Reflection.PropertyInfo[] namedProperties, object[] propertyValues, System.Reflection.FieldInfo[] namedFields, object[] fieldValues);
new System.Reflection.Emit.CustomAttributeBuilder : System.Reflection.ConstructorInfo * obj[] * System.Reflection.PropertyInfo[] * obj[] * System.Reflection.FieldInfo[] * obj[] -> System.Reflection.Emit.CustomAttributeBuilder
Public Sub New (con As ConstructorInfo, constructorArgs As Object(), namedProperties As PropertyInfo(), propertyValues As Object(), namedFields As FieldInfo(), fieldValues As Object())
参数
- con
- ConstructorInfo
自定义属性的构造函数。
- constructorArgs
- Object[]
自定义属性的构造函数的参数。
- namedProperties
- PropertyInfo[]
自定义属性 (Attribute) 的命名属性 (Property)。
- propertyValues
- Object[]
自定义属性 (Attribute) 的命名属性 (Property) 的值。
- namedFields
- FieldInfo[]
自定义属性的命名字段。
- fieldValues
- Object[]
自定义属性的命名字段的值。
例外
namedProperties 和 propertyValues 数组的长度不相同。
- 或 -
namedFields 和 fieldValues 数组的长度不相同。
- 或 -
con 为静态或私有。
- 或 -
提供的参数数目与构造函数的调用约定所需的构造函数的参数数目不匹配。
- 或 -
提供的参数类型与构造函数中声明的参数类型不匹配。
- 或 -
属性值的类型与命名属性的类型不匹配。
- 或 -
字段值的类型与相应的字段类型的类型不匹配。
- 或 -
属性没有 setter。
- 或 -
该属性或字段不属于与构造函数相同的类或基类。
- 或 -
其中一个参数为 null。
注解
、 propertyValues或 fieldValues 数组的constructorArgs元素仅限于元素类型。 它们可以是 byte、、、int、uintfloatboollongcharulongStringdouble、枚举、类型、以前已强制转换为对象的任何类型,或任何先前类型的单维、从零开始的数组。 sbyte
重要
不要在 或 中包含 namedProperties 私有属性或 namedFields字段。 这样做将导致 CustomAttributeFormatException 稍后对完成的类型调用 方法时 GetCustomAttributes 引发。