Open sandboxFocus

Method IsAutoPropertyBackingField

IsAutoPropertyBackingField(IField)

Determines whether the specified field is a compiler-generated backing field for an auto-property.

Declaration
public static bool IsAutoPropertyBackingField(this IField field)
Parameters
Type Name Description
IField field

The field to check.

Returns
Type Description
bool

true if the field is an auto-property backing field; otherwise, false.

Remarks

Compiler-generated backing fields follow the naming pattern <PropertyName>k__BackingField. This method efficiently checks only the field name pattern.