CSharp examples for Custom Type:Field
Create properties with backend fields
using System;/*from www .j a va2 s .c om*/ class Student { private string code = "N.A"; private string name = "not known"; private int age = 0; public string Code { get { return code; } set { code = value; } } public string Name { get { return name; } set { name = value; } } public int Age { get { return age; } set { age = value; } } public override string ToString() { return "Code = " + Code +", Name = " + Name + ", Age = " + Age; } } class MainClass { public static void Main() { Student s = new Student(); s.Code = "001"; s.Name = "PinkMan"; s.Age = 9; Console.WriteLine("Student Info: {0}", s); s.Age += 1; Console.WriteLine("Student Info: {0}", s); } }