Version 2.1.0.0

MemberAliasPropertyInfo class

Namespace: Sirenix.Utilities
Assembly: Sirenix.Utilities
public sealed class MemberAliasPropertyInfo : PropertyInfo, ICustomAttributeProvider, _MemberInfo, _PropertyInfo
Provides a methods of representing imaginary properties which are unique to serialization.

We aggregate the PropertyInfo associated with this member and return a mangled form of the name.

Inheritance
  • System.Object
  • System.Reflection.MemberInfo
  • System.Reflection.PropertyInfo
  • MemberAliasPropertyInfo
See Also
  • System.Reflection.FieldInfo

Constructors

MemberAliasPropertyInfo(PropertyInfo, String)
Initializes a new instance of the MemberAliasPropertyInfo class.
public MemberAliasPropertyInfo(PropertyInfo prop, string namePrefix)
Parameters
System.Reflection.PropertyInfo prop

The property to alias.

System.String namePrefix

The name prefix to use.

MemberAliasPropertyInfo(PropertyInfo, String, String)
Initializes a new instance of the MemberAliasPropertyInfo class.
public MemberAliasPropertyInfo(PropertyInfo prop, string namePrefix, string separatorString)
Parameters
System.Reflection.PropertyInfo prop

The property to alias.

System.String namePrefix

The name prefix to use.

System.String separatorString

The separator string to use.

Properties

AliasedProperty
Not yet documented.
public PropertyInfo AliasedProperty { get; }
Attributes
Gets the attributes.
public override PropertyAttributes Attributes { get; }
CanRead
Gets a value indicating whether this instance can read.
public override bool CanRead { get; }
CanWrite
Gets a value indicating whether this instance can write.
public override bool CanWrite { get; }
DeclaringType
Gets the class that declares this member.
public override Type DeclaringType { get; }
MetadataToken
Gets a value that identifies a metadata element.
public override int MetadataToken { get; }
Module
Gets the module in which the type that declares the member represented by the current System.Reflection.MemberInfo is defined.
public override Module Module { get; }
Name
Gets the name of the current member.
public override string Name { get; }
PropertyType
Gets the type of the property.
public override Type PropertyType { get; }
ReflectedType
Gets the class object that was used to obtain this instance of MemberInfo.
public override Type ReflectedType { get; }

Methods

GetAccessors(Boolean)
Returns an array whose elements reflect the public and, if specified, non-public get, set, and other accessors of the property reflected by the current instance.
public override MethodInfo[] GetAccessors(bool nonPublic)
Parameters
System.Boolean nonPublic

Indicates whether non-public methods should be returned in the MethodInfo array. true if non-public methods are to be included; otherwise, false.

Returns
System.Reflection.MethodInfo[]

An array of System.Reflection.MethodInfo objects whose elements reflect the get, set, and other accessors of the property reflected by the current instance. If nonPublic is true, this array contains public and non-public get, set, and other accessors. If nonPublic is false, this array contains only public get, set, and other accessors. If no accessors with the specified visibility are found, this method returns an array with zero (0) elements.

GetCustomAttributes(Boolean)
When overridden in a derived class, returns an array of all custom attributes applied to this member.
public override object[] GetCustomAttributes(bool inherit)
Parameters
System.Boolean inherit

True to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events; see Remarks.

Returns
System.Object[]

An array that contains all the custom attributes applied to this member, or an array with zero elements if no attributes are defined.

GetCustomAttributes(Type, Boolean)
When overridden in a derived class, returns an array of custom attributes applied to this member and identified by System.Type.
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Parameters
System.Type attributeType

The type of attribute to search for. Only attributes that are assignable to this type are returned.

System.Boolean inherit

True to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events; see Remarks.

Returns
System.Object[]

An array of custom attributes applied to this member, or an array with zero elements if no attributes assignable to attributeType have been applied.

GetGetMethod(Boolean)
When overridden in a derived class, returns the public or non-public get accessor for this property.
public override MethodInfo GetGetMethod(bool nonPublic)
Parameters
System.Boolean nonPublic

Indicates whether a non-public get accessor should be returned. true if a non-public accessor is to be returned; otherwise, false.

Returns
System.Reflection.MethodInfo

A MethodInfo object representing the get accessor for this property, if nonPublic is true. Returns null if nonPublic is false and the get accessor is non-public, or if nonPublic is true but no get accessors exist.

GetIndexParameters()
Gets the index parameters of the property.
public override ParameterInfo[] GetIndexParameters()
Returns
System.Reflection.ParameterInfo[]

The index parameters of the property.

GetSetMethod(Boolean)
When overridden in a derived class, returns the set accessor for this property.
public override MethodInfo GetSetMethod(bool nonPublic)
Parameters
System.Boolean nonPublic

Indicates whether the accessor should be returned if it is non-public. true if a non-public accessor is to be returned; otherwise, false.

Returns
System.Reflection.MethodInfo

Value Condition A System.Reflection.MethodInfo object representing the Set method for this property. The set accessor is public.-or- nonPublic is true and the set accessor is non-public. nullnonPublic is true, but the property is read-only.-or- nonPublic is false and the set accessor is non-public.-or- There is no set accessor.

GetValue(Object, BindingFlags, Binder, Object[], CultureInfo)
Gets the value of the property on the given instance.
public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
Parameters
System.Object obj

The object to invoke the getter on.

System.Reflection.BindingFlags invokeAttr

The System.Reflection.BindingFlags to invoke with.

System.Reflection.Binder binder

The binder to use.

System.Object[] index

The indices to use.

System.Globalization.CultureInfo culture

The culture to use.

Returns
System.Object

The value of the property on the given instance.

IsDefined(Type, Boolean)
When overridden in a derived class, indicates whether one or more attributes of the specified type or of its derived types is applied to this member.
public override bool IsDefined(Type attributeType, bool inherit)
Parameters
System.Type attributeType

The type of custom attribute to search for. The search includes derived types.

System.Boolean inherit

True to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events; see Remarks.

Returns
System.Boolean

True if one or more instances of attributeType or any of its derived types is applied to this member; otherwise, false.

SetValue(Object, Object, BindingFlags, Binder, Object[], CultureInfo)
Sets the value of the property on the given instance.
public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
Parameters
System.Object obj

The object to set the value on.

System.Object value

The value to set.

System.Reflection.BindingFlags invokeAttr

The System.Reflection.BindingFlags to invoke with.

System.Reflection.Binder binder

The binder to use.

System.Object[] index

The indices to use.

System.Globalization.CultureInfo culture

The culture to use.

Extension Methods

This website is brand new and built with the Odin 2.1 beta in mind. This means you might discover some features such as attribute expressions that are only available in the beta.

You can download the 2.1 beta from here and read the patch-notes here.