class Program { static void Main(string[] args) { readName S1 = new readName(); S1.MGo = Console.ReadLine(); Console.WriteLine(S1.MGo + "__" + S1.MM); Console.ReadKey(); } } class readName { public string MM; public string MGo { get { //读取MGo时执行的代码 return "9999"; } set { //设置MGo时执行的代码 if (value == "1") { this.MM = "Top"; return; } this.MM = value; } } }
原文地址:http://chikeyi.blog.51cto.com/7504707/1692205