© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
V. SarcarTest Your Skills in C# Programming https://doi.org/10.1007/978-1-4842-8655-5_7

7. Encapsulation Using Properties and Indexers

Vaskaran Sarcar1  
(1)
Garia, Kolkata, West Bengal, India
 
In object-oriented programming, we do not allow free data flow inside the system. Instead, we like to wrap the data and functions (i.e., methods) into a single unit (similar to forming a capsule). Why is this important? The answer is that if you want to promote security, your data should not be visible from the outside world. So, in general, you allow access to this data only through the methods defined inside the class. Therefore, you can think of these methods as the ...

Get Test Your Skills in C# Programming: Review and Analyze Important Features of C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.