C# Access Modifiers (beyond public and private) - what they are, how to use them, and best practices

C# Access Modifiers (beyond public and private) - what they are, how to use them, and best practices

248.079 Lượt nghe
C# Access Modifiers (beyond public and private) - what they are, how to use them, and best practices
An access modifier in C# specifies who can see and use a resource. You probably are familiar with public and private. We use those a lot but did you know that there are others? In this video, I am going to cover six different access modifiers and when you would use each. We are also going to discuss why we have various modifiers and it isn't just about security. Full courses: https://www.iamtimcorey.com/ Source Code: https://leadmagnets.app/?Resource=AccessModifiersDemo Patreon: https://patreon.com/IAmTimCorey Mailing List: https://signup.iamtimcorey.com/ 0:00 - Intro 1:01 - Demo App explained 2:03 - Private:"The code is only accessible within the same class." 7:03 - Internal:"The code is only accessible within its own assembly, but not from another assembly" 10:06 - Public:"The code is accessible for all classes" 12:58 - Protected:"The code is accessible within the same class, or in a class that is inherited from that class" 17:04 - Private Protected 20:36 - Protected Internal 22:04 - Access Modifiers: overview 23:12 - Real-life practice, general advice, example 31:31 - Why not to make everything public 39:39 - Effect of Access Modifiers on the development process 44:01 - Conclusions