What's the diffetence between a regular variable and a property? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What's the diffetence between a regular variable and a property?

In oop C# i noticed the use of properties to hold values just the same as regular variables, so what's the point of using them?

5th Jun 2019, 11:22 PM
Ibrahim Yasir
Ibrahim Yasir - avatar
1 Answer
+ 1
properties are a special type of method that expose the specific variable. Since its a method, you can do much more with a property rather than just exposing a variable.
6th Jun 2019, 12:58 AM
Pr0gr@mm3r6969
Pr0gr@mm3r6969 - avatar