basics

/Tag: basics

Properties – the basics

By |2018-06-19T13:12:15+00:00March 4th, 2017|Categories: Technical|Tags: , |

Properties in C# is a special type of methods called accessors, they are accessed as if they are public member fields but with read, write and compute the value. Is is declared like a field but with a get and set blocks inside, get is to read the property value and must return the same property type, set is to write to the property, using an implicit parameter called value. Typically properties read and write from/to fields, private int _salary; public int Salary { get { return _salary; } set { _salary = value; } }   but we can also [...]