© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•5mo ago•
12 replies
Faker

✅ Importance of getters and setters

Hello, can someone explain the importance of getters and setters in programming please.

I know with setters, we can check for conditions, like if age < 18, then do something but apart from that, why do we force devs to make use of setters/getters?


for e.g consider:
person.name = "John"
person.name = "John"


why is name a private property. Why force us to use a setter instead of just making name public?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

are my getters and setters correct?
C#CC# / help
3y ago
❔ Difference between public property with protected setters and getters and protected property?
C#CC# / help
3y ago
need help with properties and their setters
C#CC# / help
4y ago
✅ Am i misremembering how Getters work?
C#CC# / help
5mo ago