Backing Field
noun
say it: “BAK-ing feeld” /ˈbækɪŋ fiːld/
The private field that holds the value a property reads and sets.
What is Backing Field in C#?
Backing Field — The private field that holds the value behind a property. The property's get and set read and write it, so the class can check a value before storing it. An auto-property has one too; C# just hides it.
class Team
{
private int wins; // the backing field
public int Wins
{
get => wins;
set => wins = value < 0 ? 0 : value;
}
}
In a sentence
- “The Wins property checks the value before storing it in its backing field, wins.”
Level: Journeyman · More C# terms at this level
Updated