+ 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?

3rd Jan 2018, 3:32 AM
Justin Renaud
Justin Renaud - avatar
2 Respostas
+ 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.
4th Jan 2018, 10:01 PM
John Appling
John Appling - avatar