+ 1
What is get and set in c#?
I don’t understand the concept so can someone explain me? Can I see an easy example of why would we use it?
2 Réponses
+ 1
Get and set in c# is basically for accessing private variables in a class. Example:
class A has a private variable named z. If you want to find out what the value of z is, you call the get method. If you want to change the value of z, you call the set method.