CustomAttributeBuilder 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化該類別的 CustomAttributeBuilder 實例。
多載
| 名稱 | Description |
|---|---|
| CustomAttributeBuilder(ConstructorInfo, Object[]) |
初始化該類別的實例 |
| CustomAttributeBuilder(ConstructorInfo, Object[], FieldInfo[], Object[]) |
初始化該類別的實例 |
| CustomAttributeBuilder(ConstructorInfo, Object[], PropertyInfo[], Object[]) |
初始化該類別的實例 |
| CustomAttributeBuilder(ConstructorInfo, Object[], PropertyInfo[], Object[], FieldInfo[], Object[]) |
初始化該類別的實例 |
CustomAttributeBuilder(ConstructorInfo, Object[])
初始化該類別的實例 CustomAttributeBuilder ,給定自訂屬性的建構子及建構子的參數。
public:
CustomAttributeBuilder(System::Reflection::ConstructorInfo ^ con, cli::array <System::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、 sbyte、uintcharintulongboollongfloatdoubleString一個列舉、一個型別、任何先前被鑄造到物件的前述型態,或是任何先前類型中的單維零基陣列。
適用於
CustomAttributeBuilder(ConstructorInfo, Object[], FieldInfo[], Object[])
初始化該類別的實例 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);
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[]
自訂屬性中命名欄位的值。
例外狀況
和 fieldValues 陣列的長度namedFields不同。
-或-
con 是靜態或私密。
-或-
所提供的參數數量與建構子呼叫慣例所要求的參數數不相符。
-或-
所提供的參數類型與建構子中宣告的參數類型不符。
-或-
欄位值的類型與命名欄位的類型不符。
-或-
該欄位不屬於與建構子相同的類別或基底類別。
-或-
其中一個參數是 null。
備註
和 fieldValues 陣列的constructorArgs元素限制於元素類型。 它們可以是 byte、 sbyte、uintcharintulongboollongfloatdoubleString一個列舉、一個型別、任何先前被鑄造到物件的前述型態,或是任何先前類型中的單維零基陣列。
Important
請勿在 中包含私有欄位。namedFields 若如此 CustomAttributeFormatException ,當 GetCustomAttributes 該方法在完成型別上被呼叫時,會被拋出。
適用於
CustomAttributeBuilder(ConstructorInfo, Object[], PropertyInfo[], Object[])
初始化該類別的實例 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);
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[]
自訂屬性的命名屬性。
- propertyValues
- Object[]
自訂屬性中命名屬性的值。
例外狀況
和 propertyValues 陣列的長度namedProperties不同。
-或-
con 是靜態或私密。
-或-
所提供的參數數量與建構子呼叫慣例所要求的參數數不相符。
-或-
所提供的參數類型與建構子中宣告的參數類型不符。
-或-
房產價值的類型與所命名房產的類型不符。
-或-
屬性沒有設定方法。
-或-
該屬性不屬於與建構子相同的類別或基底類別。
-或-
其中一個參數是 null。
備註
和 propertyValues 陣列的constructorArgs元素限制於元素類型。 它們可以是 byte、 sbyte、uintcharintulongboollongfloatdoubleString一個列舉、一個型別、任何先前被鑄造到物件的前述型態,或是任何先前類型中的單維零基陣列。
Important
請勿將私人財產納入 namedProperties。 若如此 CustomAttributeFormatException ,當 GetCustomAttributes 該方法在完成型別上被呼叫時,會被拋出。
適用於
CustomAttributeBuilder(ConstructorInfo, Object[], PropertyInfo[], Object[], FieldInfo[], Object[])
初始化該類別的實例 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);
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[]
自訂屬性的命名屬性。
- propertyValues
- Object[]
自訂屬性中命名屬性的值。
- namedFields
- FieldInfo[]
自訂屬性的命名欄位。
- fieldValues
- Object[]
自訂屬性中命名欄位的值。
例外狀況
和 propertyValues 陣列的長度namedProperties不同。
-或-
和 fieldValues 陣列的長度namedFields不同。
-或-
con 是靜態或私密。
-或-
所提供的參數數量與建構子呼叫慣例所要求的參數數不相符。
-或-
所提供的參數類型與建構子中宣告的參數類型不符。
-或-
房產價值的類型與所命名房產的類型不符。
-或-
欄位值的類型與對應欄位類型的類型不相符。
-或-
一個屬性沒有設定者。
-或-
屬性或欄位不屬於與建構子相同的類別或基底類別。
-或-
其中一個參數是 null。
備註
、 或 fieldValues 陣列的constructorArgspropertyValues元素限制於元素類型。 它們可以是 byte、 sbyte、uintcharintulongboollongfloatdoubleString一個列舉、一個型別、任何先前被鑄造到物件的前述型態,或是任何先前類型中的單維零基陣列。
Important
請勿將私人財產或田地納入 namedProperties 或 namedFields。 若如此 CustomAttributeFormatException ,當 GetCustomAttributes 該方法在完成型別上被呼叫時,會被拋出。