Skip to content

FieldOrPropertyInfo

Namespace: SideXP.Core.Reflection | Inherits from: MemberInfo

public class FieldOrPropertyInfo : MemberInfo

Groups informations about a field or a property queried using C# reflection.

Constructors

FieldOrPropertyInfo(MemberInfo)

public FieldOrPropertyInfo(MemberInfo memberInfo)

Groups informations about a field or a property queried using C# reflection.

Parameters

  • memberInfo: The field or property to represent.

Properties

FieldInfo

public FieldInfo FieldInfo

Informations about the field. Null if the element is a property (see Property).

PropertyInfo

public PropertyInfo PropertyInfo

Informations about the property. Null if the element is a field (see Field).

Name

public override string Name

Inherited documentation.

DeclaringType

public override Type DeclaringType

Inherited documentation.

MemberType

public override MemberTypes MemberType

Inherited documentation.

ReflectedType

public override Type ReflectedType

Inherited documentation.

Type

public Type Type

Gets the type of the represented field or property.

IsField

public bool IsField

Checks if this object represents a field.

IsProperty

public bool IsProperty

Checks if this object represents a property.

IsValid

public bool IsValid

Checks if a valid member has been assigned to this object.

CanRead

public bool CanRead

Checks if the value of the element can be read.

CanWrite

public bool CanWrite

Checks if the value of the element can be set.

IsPublic

public bool IsPublic

Checks if a given member (field or property) is public.

Returns

Returns true if the given member is public.

Remarks

A property is considered public if one of its accessors is marked as public.

IsPrivate

public bool IsPrivate

Checks if a given member (field or property) is private.

Returns

Returns true if the given member is private.

Remarks

A property is considered private if its accessors are both marked as private.

Methods

GetCustomAttributes(bool)

public override object[] GetCustomAttributes(bool inherit)

Inherited documentation.

GetCustomAttributes(Type, bool)

public override object[] GetCustomAttributes(Type attributeType, bool inherit)

Inherited documentation.

IsDefined(Type, bool)

public override bool IsDefined(Type attributeType, bool inherit)

Inherited documentation.

GetValue(object)

public object GetValue(object target)

Gets the value of this field or property.

Parameters

  • target: The object that owns the field or property to read.

Returns

Returns the value of the field or property.

GetValue<T>(object)

public T GetValue<T>(object target)

Gets the value of this field or property.

Type parameters

  • T: The expected type of the value.

Parameters

  • target: The object that owns the field or property to read.

Returns

Returns the value of the field or property.

SetValue(object, object)

public void SetValue(object target, object value)

Sets the value of this field or property.

Parameters

  • target: The object that owns the field or property to set.
  • value: The value you want to set for the field or property.