0
How property is different from fields in this case?
class MathClass { public const int ONE = 1; } static void Main(string[] args) { Console.Write(MathClass.ONE); } //Outputs 1 In one of the module, it was written ONE variable is a property and I cannot see any accessor here nor it is an auto-implemented property.
1 Réponse
+ 1
You dont need to use a static modifier if using the keyword const it's done for you by default, this is why you dont need to create an instance of this class to access its properties, once the const variable is assigned its value stays the same throughout the program.