private Modifier

Declares that a class member has private visibility.

private statement


  • statement
    Required. A class member definition.


The private modifier makes a member of a class visible only within that class. Code outside the current class, including derived classes, cannot access private members.

Classes and interfaces in the global scope cannot be marked with the private modifier. Any member of a class or interface (including nested classes and nested interfaces) can be marked with the private modifier.

You may not combine the private modifier with any of the other visibility modifiers (public, protected, or internal).


Version .NET

See Also


public Modifier

protected Modifier

internal Modifier

var Statement

function Statement

class Statement


Scope of Variables and Constants

Other Resources