Accessors property are use to read, write, or compute their values. Basically property are a member of classes, structures, and interfaces. The accessor property of a contains the executable statements that helps in getting or setting the property.
Example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace accessors_property_in_c_sharp
{
class User_detail
{
private int id = 0;
private string name = "not known";
private string city = "N.A";
public int Id // Declare a Id property of type int:
{
get
{
return id;
}
set
{
id = value;
}
}
public string Name // Declare a Name property of type string:
{
get
{
return name;
}
set


Join the conversation! Your thoughts help the community grow.