in Education by
What are accessors in C#?

1 Answer

0 votes
by

The get and set portions or blocks of a property are called accessors. These are useful to restrict the accessibility of a property. The set accessor specifies that we can assign a value to a private field in a property. Without the set accessor property, it is like a readonly field. With the 'get' accessor we can access the value of the private field. In other words, it returns a single value. A Get accessor specifies that we can access the value of a field publically.

Related questions

0 votes
    What are sealed classes in C#?...
asked Mar 31, 2021 in Education by JackTerrance
0 votes
    What are extension methods in C#?...
asked Mar 31, 2021 in Education by JackTerrance
0 votes
    What is Boxing and Unboxing in C#?...
asked Jul 9, 2021 in General by JackTerrance
0 votes
    What is a Hashtable in C#?...
asked Apr 1, 2021 in Education by JackTerrance
0 votes
    What is Serialization in C#?...
asked Apr 1, 2021 in Education by JackTerrance
0 votes
    What is the difference between late binding and early binding in C#?...
asked Mar 31, 2021 in Education by JackTerrance
0 votes
    What is IEnumerable in C#?...
asked Mar 31, 2021 in Education by JackTerrance
0 votes
    What is the difference between boxing and unboxing in C#?...
asked Mar 31, 2021 in Education by JackTerrance
0 votes
    What is the difference between String and StringBuilder in C#?...
asked Mar 31, 2021 in Education by JackTerrance
0 votes
    What are various ways of doing alignment in WPF?...
asked Apr 9, 2021 in Education by JackTerrance
0 votes
0 votes
    What are static and dynamic resources?...
asked Apr 8, 2021 in Education by JackTerrance
...