CustomReflectionContext.CreateProperty 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
创建一个对象,该对象表示要添加到类型中的属性,由 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>) |
创建一个对象,该对象表示要添加到某一类型的属性,该属性用于 AddProperties(Type) 该方法和使用指定的自定义属性。 |
CreateProperty(Type, String, Func<Object,Object>, Action<Object,Object>)
- Source:
- CustomReflectionContext.cs
- Source:
- CustomReflectionContext.cs
- Source:
- CustomReflectionContext.cs
- Source:
- 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);
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(Type) 上下文中使用。
适用于
CreateProperty(Type, String, Func<Object,Object>, Action<Object,Object>, IEnumerable<Attribute>, IEnumerable<Attribute>, IEnumerable<Attribute>)
- Source:
- CustomReflectionContext.cs
- Source:
- CustomReflectionContext.cs
- Source:
- CustomReflectionContext.cs
- Source:
- 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, 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
要创建的属性的名称。
- propertyCustomAttributes
- IEnumerable<Attribute>
要应用于该属性的自定义属性的集合。
- getterCustomAttributes
- IEnumerable<Attribute>
要应用于属性访问器的自定义属性的 get 集合。
- setterCustomAttributes
- IEnumerable<Attribute>
要应用于属性访问器的自定义属性的 set 集合。
返回
一个表示属性的对象。
注解
此方法返回的对象不是完整的 PropertyInfo 对象,应仅在方法的 AddProperties(Type) 上下文中使用。