MVP, Author


Hits: 94

Dictionary Meaning:

The meaning of “Accessor” is “Someone or something that accesses”.

What is Accessor?

In C# programming, the accessor function is like getter accessor (get) and setter accessor (Set) functions. This is used to change the class member access label by set to public.

In OOP aspects as it provides an abstraction layer that hides the implementation details of functionality sets.

For example:

The get accessor:

Get accessor return/retrive value from private field.

For example:

The set accessor:

Set accessor is to assign/storing a value in private variables. It uses an implicit parameter called value.

For example:

When we assign a value to the property, the set accessor is invoked by using an argument that provides the new value.

For example:


  1. A property without a set accessor is considered read-only.
  2. A property without a get accessor is considered write-only.
  3. A property that has both accessors is read-write.

Post a comment