public static int Id { get; set; }
It does not show any error but what is the exact definition of this statement?
public static int Id { get; set; }
It does not show any error but what is the exact definition of this statement?
What you're doing is to declare a property. From dotnetperls:
Property. On a class, a property gets and sets values. A simplified syntax form, properties are implemented in the IL as methods.
With properties, we create standard access points from external places. We access Name, not GetName(). This leads to simpler code. It provides data-binding features.
This statement indicates that you declare the getter
and setter
of int Id
Where you want to get
or set
the value of int id
you can call like this id.get() & id.set()
for set some value init.