private
An access modifier that lets a member be used only inside the class or struct that declares it.
What is private in C#?
private — An access modifier that lets a member be used only inside the class or struct that declares it.
class Account
{
private int balance = 20;
public int Balance()
{
return balance; // allowed: inside Account
}
}
// new Account().balance won't compile: balance is private
Level: Journeyman · More C# terms at this level
Updated