https://github.com/jepozdemir/csharp_access_modifiers
Demonstrates how different access modifiers control the accessibility of fields and methods within a class.
https://github.com/jepozdemir/csharp_access_modifiers
access-modifiers accessibility-levels csharp csharp-code csharp-core dotnet dotnetframework
Last synced: 10 months ago
JSON representation
Demonstrates how different access modifiers control the accessibility of fields and methods within a class.
- Host: GitHub
- URL: https://github.com/jepozdemir/csharp_access_modifiers
- Owner: jepozdemir
- Created: 2024-11-02T11:29:11.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-02T13:17:00.000Z (about 1 year ago)
- Last Synced: 2025-02-14T00:18:37.357Z (12 months ago)
- Topics: access-modifiers, accessibility-levels, csharp, csharp-code, csharp-core, dotnet, dotnetframework
- Language: C#
- Homepage: https://medium.com/c-sharp-programming/c-access-modifiers-9a65a5cd9133
- Size: 72.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

This repository contains code samples referenced in my Medium blog post, ["C# Access Modifiers"](https://medium.com/c-sharp-programming/c-access-modifiers-9a65a5cd9133). This post and repository focus on understanding and utilizing access modifiers in C#, which control the visibility of classes, methods, and other members.
## Overview
In this blog post, I discuss various access modifiers in C# that help define the scope and accessibility of types and their members. Each modifier is demonstrated with code examples to show how they can be effectively used to implement encapsulation and data hiding.
### Accessibility Levels Covered
- **Public**
Members are accessible from anywhere.
- **Private**
Members are accessible only within the containing class.
- **Protected**
Members are accessible within the containing class and by derived class instances.
- **Internal**
Members are accessible only within the same assembly (project).
- **Protected Internal**
Members are accessible from within the same assembly or from derived classes in another assembly.
- **Private Protected**
Members are accessible within the containing class and by derived class instances, but only if those derived classes are within the same assembly.
- **File (Internal)**
Members are accessible only within the file in which they are declared.
## How to Use
1. **Read the Blog Post**: Start by reading the full blog post on Medium [here](https://medium.com/c-sharp-programming/c-access-modifiers-9a65a5cd9133).
2. **Explore Code Samples**: Review the repository for code examples demonstrating each access modifier.
3. **Practice Usage**: Use the provided examples to practice applying access modifiers in your own C# projects.
## Contributing
Contributions are welcome! If you have suggestions for improvements or additional examples, feel free to open an issue or submit a pull request.
## Feedback and Suggestions
If you have any feedback on the blog post or this repository, please leave a comment on the Medium post or reach out through GitHub issues.
## License
This project is licensed under the MIT License.
*Thank you!*
*If you found this helpful and would like to show support; don't forget to give it a star and share it with others who might benefit from it.👏👏👏👏👏*