public sealed class PropertyBuilder : PropertyInfo
|
| Attributes | Read-only Overridden: Gets the attributes for this property. |
| CanRead | Read-only Overridden: Gets a value indicating whether the property can be read. |
| CanWrite | Read-only Overridden: Gets a value indicating whether the property can be written to. |
| DeclaringType | Read-only Overridden: Gets the class that declares this member. |
| IsSpecialName (inherited from System.Reflection.PropertyInfo) |
Read-only See base class member description: System.Reflection.PropertyInfo.IsSpecialName Gets a value indicating whether the property is the special name. |
| MemberType (inherited from System.Reflection.PropertyInfo) |
Read-only See base class member description: System.Reflection.PropertyInfo.MemberType Gets the Type of property reflected by this PropertyInfo object. |
| Name | Read-only Overridden: Gets the name of this member. |
| PropertyToken | Read-only Retrieves the token for this property. |
| PropertyType | Read-only Overridden: Gets the type of the field of this property. |
| ReflectedType | Read-only Overridden: Gets the class object that was used to obtain this instance of MemberInfo. |
| AddOtherMethod | Adds one of the other methods associated with this property. |
| Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
| GetAccessors (inherited from System.Reflection.PropertyInfo) |
Overloaded:GetAccessors()See base class member description: System.Reflection.PropertyInfo.GetAccessorsReturns an array of the public get and set accessors on this property, and any method associated with this property. |
| GetAccessors | Overloaded:GetAccessors(bool nonPublic)Overridden: Returns an array of the public and non-public get and set accessors on this property. |
| GetCustomAttributes | Overloaded:GetCustomAttributes(bool inherit)Overridden: Returns an array of all the custom attributes for this property. |
| GetCustomAttributes | Overloaded:GetCustomAttributes(Type attributeType, bool inherit)Overridden: Returns an array of custom attributes identified by Type. |
| GetGetMethod (inherited from System.Reflection.PropertyInfo) |
Overloaded:GetGetMethod()See base class member description: System.Reflection.PropertyInfo.GetGetMethodReturns the public get accessor for this property. |
| GetGetMethod | Overloaded:GetGetMethod(bool nonPublic)Overridden: Returns the public and non-public get accessor for this property. |
| GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
| GetIndexParameters | Overridden: Returns an array of all the index parameters for the property. |
| GetSetMethod (inherited from System.Reflection.PropertyInfo) |
Overloaded:GetSetMethod()See base class member description: System.Reflection.PropertyInfo.GetSetMethodReturns the public set accessor for this property. |
| GetSetMethod | Overloaded:GetSetMethod(bool nonPublic)Overridden: Returns the set accessor for this property. |
| GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
| GetValue | Overloaded:GetValue(object obj, object[] index)Overridden: Gets the value of the indexed property by calling the property's getter method. |
| GetValue | Overloaded:GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)Overridden: Gets the value of a property having the specified binding, index, and CultureInfo. |
| IsDefined | Overridden: Indicates whether one or more instance of attributeType is defined on this property. |
| SetConstant | Sets the default value of this property. |
| SetCustomAttribute | Overloaded:SetCustomAttribute(CustomAttributeBuilder customBuilder) Set a custom attribute using a custom attribute builder. |
| SetCustomAttribute | Overloaded:SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) Set a custom attribute using a specified custom attribute blob. |
| SetGetMethod | Sets the method that gets the property value. |
| SetSetMethod | Sets the method that sets the property value. |
| SetValue | Overloaded:SetValue(object obj, object value, object[] index)Overridden: Sets the value of the property with optional index values for index properties. |
| SetValue | Overloaded:SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)Overridden: Sets the property value for the given object to the given value. |
| ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
| Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
| MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public override PropertyAttributes Attributes {get;}
|
public override bool CanRead {get;}
|
public override bool CanWrite {get;}
|
public override Type DeclaringType {get;}
|
public bool IsSpecialName {get;}
|
To get the IsSpecialName property, first get the class Type. From the Type, get the PropertyInfo. From the PropertyInfo, get the IsSpecialName value.
public override MemberTypes MemberType {get;}
|
To get the MemberType property, first get the class Type. From the Type, get the PropertyInfo. From the PropertyInfo, get the MemberType value.
using System;
using System.Reflection;
class Mypropertyinfo
{
public static int Main()
{
Console.WriteLine("\nReflection.PropertyInfo");
//Get the type and PropertyInfo
Type MyType = Type.GetType("System.Reflection.MemberInfo");
PropertyInfo Mypropertyinfo = MyType.GetProperty("Name");
//Read and display the MemberType property
Console.Write("\nMemberType = " + Mypropertyinfo.MemberType.ToString());
return 0;
}
}
/*
Produces the following output
Reflection.PropertyInfo
MemberType = Property
*/
public override string Name {get;}
|
public PropertyToken PropertyToken {get;}
|
public override Type PropertyType {get;}
|
public override Type ReflectedType {get;}
|
public void AddOtherMethod( |
mdBuilder
| Exception Type | Condition |
|---|---|
| ArgumentNullException | mdBuilder is null. |
| InvalidOperationException | TypeBuilder.CreateType has been called on the enclosing type. |
~PropertyBuilder(); |
public MethodInfo[] GetAccessors(); |
public override MethodInfo[] GetAccessors( |
nonPublic
| Exception Type | Condition |
|---|---|
| NotSupportedException | This method is not supported. |
inherit
| Exception Type | Condition |
|---|---|
| NotSupportedException | This method is not supported. |
attributeType
inherit
| Exception Type | Condition |
|---|---|
| NotSupportedException | This method is not supported. |
public MethodInfo GetGetMethod(); |
To use the GetGetMethod method, first get the class Type. From the Type, get the PropertyInfo. From the PropertyInfo, use the GetGetMethod method.
public override MethodInfo GetGetMethod( |
nonPublic
public virtual int GetHashCode(); |
public override ParameterInfo[] GetIndexParameters(); |
| Exception Type | Condition |
|---|---|
| NotSupportedException | This method is not supported. |
public MethodInfo GetSetMethod(); |
To use the GetSetMethod method, first get the class Type. From the Type, get the PropertyInfo. From the PropertyInfo, use the GetSetMethod method.
public override MethodInfo GetSetMethod( |
nonPublic
| Value | Condition |
|---|---|
| A MethodInfo object representing the Set method for this property. | The set accessor is public.nonPublic is true and non-public methods can be returned. |
| null | nonPublic is true, but the property is read-only.nonPublic is false and the set accessor is non-public. |
public Type GetType(); |
obj
index
| Exception Type | Condition |
|---|---|
| NotSupportedException | This method is not supported. |
public override object GetValue( |
obj
invokeAttr
binder
index
culture
| Exception Type | Condition |
|---|---|
| NotSupportedException | This method is not supported. |
attributeType
inherit
| Exception Type | Condition |
|---|---|
| NotSupportedException | This method is not supported. |
protected object MemberwiseClone(); |
public void SetConstant( |
defaultValue
| Exception Type | Condition |
|---|---|
| InvalidOperationException | TypeBuilder.CreateType has been called on the enclosing type. |
public void SetCustomAttribute( |
customBuilder
| Exception Type | Condition |
|---|---|
| ArgumentNullException | customBuilder is null. |
| InvalidOperationException | if TypeBuilder.CreateType has been called on the enclosing type. |
public void SetCustomAttribute( |
con
binaryAttribute
| Exception Type | Condition |
|---|---|
| ArgumentNullException | con or binaryAttribute is null. |
| InvalidOperationException | TypeBuilder.CreateType has been called on the enclosing type. |
public void SetGetMethod( |
mdBuilder
| Exception Type | Condition |
|---|---|
| ArgumentNullException | mdBuilder is null. |
| InvalidOperationException | TypeBuilder.CreateType has been called on the enclosing type. |
public void SetSetMethod( |
mdBuilder
| Exception Type | Condition |
|---|---|
| ArgumentNullException | mdBuilder is null. |
| InvalidOperationException | TypeBuilder.CreateType has been called on the enclosing type. |
obj
value
index
| Exception Type | Condition |
|---|---|
| NotSupportedException | This method is not supported. |
public override void SetValue( |
obj
value
invokeAttr
binder
index
culture
| Exception Type | Condition |
|---|---|
| NotSupportedException | This method is not supported. |
public virtual string ToString(); |