Table of Contents

Class PropertyInfoExtensions

Namespace
LfrlAnvil.Extensions
Assembly
LfrlAnvil.Core.dll

Contains PropertyInfo extension methods.

public static class PropertyInfoExtensions
Inheritance
PropertyInfoExtensions
Inherited Members

Methods

GetBackingField(PropertyInfo)

Attempts to get the compiler-generated backing field for the given source property.

[Pure]
public static FieldInfo? GetBackingField(this PropertyInfo source)

Parameters

source PropertyInfo

Source property.

Returns

FieldInfo

FieldInfo instance that is the backing field for the given property, if it exists, otherwise null.

Remarks

Backing field names are of the form <{PROPERTY_NAME}>k__BackingField.

GetDebugString(PropertyInfo, bool)

Creates a string representation of the provided property.

[Pure]
public static string GetDebugString(this PropertyInfo property, bool includeDeclaringType = false)

Parameters

property PropertyInfo

Source property info.

includeDeclaringType bool

When set to true, then DeclaringType will be included in the string. false by default.

Returns

string

String representation of the provided property.

IsIndexer(PropertyInfo)

Checks whether or not the given property is an indexer.

[Pure]
public static bool IsIndexer(this PropertyInfo property)

Parameters

property PropertyInfo

Property to check.

Returns

bool

true when property is an indexer, otherwise false.

Remarks

See GetIndexParameters() for more information.