Hello,
I'm coding some C# and cant really get the difference between public and the properties get, set. In me world the two things is kinda the same but my guess is that I have missed something so any help would be nice ty.
Example:
Code:
class TheNumber
{
public int number;
public int Number {get; set;}
}
Then from any part of the code I can write:
Code:
TheNumber theNumber = new TheNumber();
theNumber.number = 10;
theNumber.Number = 10;
so why cant I just have a public member instead of the property one in this case?