CustomReflectionContext.CreateProperty 方法

定義

建立表示要加入至 AddProperties(Type) 方法所指定型別之屬性的物件。

多載

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>)

建立表示要加入至型別之屬性 (Property) 的物件,該型別會搭配 AddProperties(Type) 方法使用且使用指定的自訂屬性 (Attribute)。

CreateProperty(Type, String, Func<Object,Object>, Action<Object,Object>)

來源:
CustomReflectionContext.cs
來源:
CustomReflectionContext.cs
來源:
CustomReflectionContext.cs

建立表示要加入至型別之屬性的物件,該型別會搭配 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);
protected System.Reflection.PropertyInfo CreateProperty (Type propertyType, string name, Func<object,object>? getter, Action<object,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

要建立的屬性名稱。

getter
Func<Object,Object>

物件,表示屬性的 get 存取子。

setter
Action<Object,Object>

物件,表示屬性的 set 存取子。

傳回

表示屬性的物件。

備註

這個方法所傳回的物件不是完整的 PropertyInfo 物件,而且應該只在方法的內容 AddProperties 中使用。

適用於

CreateProperty(Type, String, Func<Object,Object>, Action<Object,Object>, IEnumerable<Attribute>, IEnumerable<Attribute>, IEnumerable<Attribute>)

來源:
CustomReflectionContext.cs
來源:
CustomReflectionContext.cs
來源:
CustomReflectionContext.cs

建立表示要加入至型別之屬性 (Property) 的物件,該型別會搭配 AddProperties(Type) 方法使用且使用指定的自訂屬性 (Attribute)。

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);
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);
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

要建立的屬性名稱。

getter
Func<Object,Object>

物件,表示屬性的 get 存取子。

setter
Action<Object,Object>

物件,表示屬性的 set 存取子。

propertyCustomAttributes
IEnumerable<Attribute>

要套用至屬性 (Property) 之自訂屬性 (Attribute) 的集合。

getterCustomAttributes
IEnumerable<Attribute>

要套用至屬性 (Property) 的 get 存取子之自訂屬性 (Attribute) 的集合。

setterCustomAttributes
IEnumerable<Attribute>

要套用至屬性 (Property) 的 set 存取子之自訂屬性 (Attribute) 的集合。

傳回

表示屬性的物件。

備註

這個方法所傳回的物件不是完整的 PropertyInfo 物件,而且應該只在方法的內容 AddProperties 中使用。

適用於