CustomReflectionContext.CreateProperty 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立一個物件,代表一個要加入到類型中的屬性,依據方法 AddProperties(Type) 所指定。
多載
| 名稱 | Description |
|---|---|
| CreateProperty(Type, String, Func<Object,Object>, Action<Object,Object>) |
建立一個物件,代表一個屬性,要加入到某個型別中,並搭配該 AddProperties(Type) 方法一起使用。 |
| CreateProperty(Type, String, Func<Object,Object>, Action<Object,Object>, IEnumerable<Attribute>, IEnumerable<Attribute>, IEnumerable<Attribute>) |
建立一個物件,代表一個屬性,需加入到某個型別中,並 AddProperties(Type) 搭配該方法並使用指定的自訂屬性。 |
CreateProperty(Type, String, Func<Object,Object>, Action<Object,Object>)
建立一個物件,代表一個屬性,要加入到某個型別中,並搭配該 AddProperties(Type) 方法一起使用。
protected:
System::Reflection::PropertyInfo ^ CreateProperty(Type ^ propertyType, System::String ^ name, Func<System::Object ^, System::Object ^> ^ getter, Action<System::Object ^, System::Object ^> ^ setter);
protected System.Reflection.PropertyInfo CreateProperty(Type propertyType, string name, Func<object,object> getter, Action<object,object> setter);
member this.CreateProperty : Type * string * Func<obj, obj> * Action<obj, obj> -> System.Reflection.PropertyInfo
Protected Function CreateProperty (propertyType As Type, name As String, getter As Func(Of Object, Object), setter As Action(Of Object, Object)) As PropertyInfo
參數
- propertyType
- Type
房產類型。
- name
- String
要創造的房產名稱。
傳回
一個代表該性質的物件。
備註
此方法回傳的物件並非完整 PropertyInfo 物件,應僅在該 AddProperties 方法的上下文中使用。
適用於
CreateProperty(Type, String, Func<Object,Object>, Action<Object,Object>, IEnumerable<Attribute>, IEnumerable<Attribute>, IEnumerable<Attribute>)
建立一個物件,代表一個屬性,需加入到某個型別中,並 AddProperties(Type) 搭配該方法並使用指定的自訂屬性。
protected:
System::Reflection::PropertyInfo ^ CreateProperty(Type ^ propertyType, System::String ^ name, Func<System::Object ^, System::Object ^> ^ getter, Action<System::Object ^, System::Object ^> ^ setter, System::Collections::Generic::IEnumerable<Attribute ^> ^ propertyCustomAttributes, System::Collections::Generic::IEnumerable<Attribute ^> ^ getterCustomAttributes, System::Collections::Generic::IEnumerable<Attribute ^> ^ setterCustomAttributes);
protected System.Reflection.PropertyInfo CreateProperty(Type propertyType, string name, Func<object,object> getter, Action<object,object> setter, System.Collections.Generic.IEnumerable<Attribute> propertyCustomAttributes, System.Collections.Generic.IEnumerable<Attribute> getterCustomAttributes, System.Collections.Generic.IEnumerable<Attribute> setterCustomAttributes);
member this.CreateProperty : Type * string * Func<obj, obj> * Action<obj, obj> * seq<Attribute> * seq<Attribute> * seq<Attribute> -> System.Reflection.PropertyInfo
Protected Function CreateProperty (propertyType As Type, name As String, getter As Func(Of Object, Object), setter As Action(Of Object, Object), propertyCustomAttributes As IEnumerable(Of Attribute), getterCustomAttributes As IEnumerable(Of Attribute), setterCustomAttributes As IEnumerable(Of Attribute)) As PropertyInfo
參數
- propertyType
- Type
房產類型。
- name
- String
要創造的房產名稱。
- propertyCustomAttributes
- IEnumerable<Attribute>
一組自訂屬性套用到該物業。
- getterCustomAttributes
- IEnumerable<Attribute>
一組自訂屬性,用來套用到屬性 get 的附件。
- setterCustomAttributes
- IEnumerable<Attribute>
一組自訂屬性,用來套用到屬性 set 的附件。
傳回
一個代表該性質的物件。
備註
此方法回傳的物件並非完整 PropertyInfo 物件,應僅在該 AddProperties 方法的上下文中使用。