Nested Class in C#:
Output of Nested Class:
Reasons to Use Nested Class:
- By using Nested Classes to nest small classes in large one can make code more readable and maintainable.
- Nested Classes is used to group all classes together that are useful to only that class, it make package Streamlined.
- Nested Classes Increase Encapsulation and if you declare the inner class "private" then you can hide the inner class from all other classes and outside world.