Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Specifies that one or more declared programming elements are accessible only from within their declaration context, including from within any contained types.
If a programming element represents proprietary functionality, or contains confidential data, you usually want to limit access to it as strictly as possible. You achieve the maximum limitation by allowing only the module, class, or structure that defines it to access it. To limit access to an element in this way, you can declare it with Private
.
Note
You can also use the Private Protected access modifier, which makes a member accessible from within that class and from derived classes located in its containing assembly.
Private
only at module level. This means the declaration context for a Private
element must be a module, class, or structure, and cannot be a source file, namespace, interface, or procedure.Access Level. All code within a declaration context can access its Private
elements. This includes code within a contained type, such as a nested class or an assignment expression in an enumeration. No code outside of the declaration context can access its Private
elements.
Access Modifiers. The keywords that specify access level are called access modifiers. For a comparison of the access modifiers, see Access levels in Visual Basic.
The Private
modifier can be used in these contexts:
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register now