what is the use of declaring
private Int64 _ID ;
public Int64 ID{get { return _ID; }set { _ID = value; } };
like this to declare a private variable
now normally in the coding we use ID directly which in turn access the _ID which is private.
How this offers more security instead of directly declaring as
public int64 ID{get;set;}
You get the
benefitof encapsulation by get and set method to be call where you can put yourcustom logic. The private_IDis a place holder to hold the data for your property which isprotectedby set method when some body writes to_id, similarly you can put custom logic before giving the value byget.This is what
msdnexplains about properties “Properties combine aspects of both fields and methods. To the user of an object, a property appears to be a field, accessing the property requires the same syntax. To the implementer of a class, a property is one or two code blocks, representing a get accessor and/or a set accessor. The code block for the get accessor is executed when the property is read; the code block for the set accessor is executed when the property is assigned a new value. A property without a set accessor is considered read-only. A property without a get accessor is considered write-only. A property that has both accessors is read-write“. You can read more over here.