- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are accessors of properties in C#?
Properties are an extension of fields and are accessed using the same syntax. They use accessors through which the values of the private fields can be read, written or manipulated.
The accessor of a property contains the executable statements that helps in getting (reading or computing) or setting (writing) the property.
Let us see an example of properties in C#.
Example
Declare a code property of type string.
public string Code { get { return code; } set { code = value; } }
In the same way, declare Age property of type as in the following code snippet.
Example
public int Age { get { return age; } set { age = value; } }
- Related Articles
- What are abstract properties in C#?
- What are the properties of array class in C#?
- JavaScript Object Accessors
- What are the methods and properties of the Thread class in C#?
- What are the properties of light?
- What are the properties of Materials
- What are the properties of subtraction?
- What are the properties of the triangle?
- What are the properties of a parallelogram?
- What are the properties of window.screen object in JavaScript?
- What are the basic properties of products in TOC?
- What are the properties of Regular expressions in TOC?
- What are the properties of MySQL user variables?
- What are the properties of an electrolytic cell?
- What are the closure properties of Regular languages?

Advertisements