CSharp examples for Custom Type:Property
Create property with underline variable
using System;/*from w w w .j av a2s. c om*/ class circle { int center_x; int center_y; double Radius; public int x { get { return center_x; } set { center_x = value; } } public int y { get { return center_y; } set { center_y = value; } } public double radius { get { return Radius; } set { Radius = value; } } } class MyApp { public static void Main() { circle myCircle = new circle(); myCircle.x = 10; myCircle.y = 10; myCircle.radius = 8; Console.WriteLine("Center: ({0},{1})", myCircle.x, myCircle.y); Console.WriteLine("Radius: {0}", myCircle.radius); Console.WriteLine("Circumference: {0}", (double) (2 * 3.14159 * myCircle.radius)); } }