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
sourcePropertyInfoSource 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
propertyPropertyInfoSource property info.
includeDeclaringTypeboolWhen 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
propertyPropertyInfoProperty to check.
Returns
- bool
true when
propertyis an indexer, otherwise false.
Remarks
See GetIndexParameters() for more information.