public class Person { private string name; public string Name { get { return name; } set { name = value; } } }
public class Circle { private double radius; public double Radius { get { return radius; } set { if (value > 0) radius = value; } } public double Area { get { return Math.PI * radius * radius; } } }This example shows how to create a property `Radius` with validation, and a read-only property `Area`. C# Property is part of the .NET Framework Class Library.