編輯

共用方式為


CustomReflectionContext.CreateProperty Method

Definition

Creates an object that represents a property to be added to a type, as specified by the AddProperties(Type) method.

Overloads

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

Creates an object that represents a property to be added to a type, to be used with the AddProperties(Type) method.

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

Creates an object that represents a property to be added to a type, to be used with the AddProperties(Type) method and using the specified custom attributes.

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

Source:
CustomReflectionContext.cs
Source:
CustomReflectionContext.cs
Source:
CustomReflectionContext.cs

Creates an object that represents a property to be added to a type, to be used with the AddProperties(Type) method.

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

Parameters

propertyType
Type

The type of the property to create.

name
String

The name of the property to create.

getter
Func<Object,Object>

An object that represents the property's get accessor.

setter
Action<Object,Object>

An object that represents the property's set accessor.

Returns

An object that represents the property.

Remarks

Objects that are returned by this method are not complete PropertyInfo objects, and should be used only in the context of the AddProperties method.

Applies to

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

Source:
CustomReflectionContext.cs
Source:
CustomReflectionContext.cs
Source:
CustomReflectionContext.cs

Creates an object that represents a property to be added to a type, to be used with the AddProperties(Type) method and using the specified custom attributes.

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

Parameters

propertyType
Type

The type of the property to create.

name
String

The name of the property to create.

getter
Func<Object,Object>

An object that represents the property's get accessor.

setter
Action<Object,Object>

An object that represents the property's set accessor.

propertyCustomAttributes
IEnumerable<Attribute>

A collection of custom attributes to apply to the property.

getterCustomAttributes
IEnumerable<Attribute>

A collection of custom attributes to apply to the property's get accessor.

setterCustomAttributes
IEnumerable<Attribute>

A collection of custom attributes to apply to the property's set accessor.

Returns

An object that represents the property.

Remarks

Objects that are returned by this method are not complete PropertyInfo objects, and should be used only in the context of the AddProperties method.

Applies to