using System;
using System.Collections.Generic;
using System.Text;namespace 对象的引用
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 10;
            int j = i;
            i++;
            Console.WriteLine(j);            Person p1 = new Person();
            Person p2 = new Person();
            p1.Age++;
            Console.WriteLine(p2);
            Console.ReadKey();
        }
    }
    class Person
    {
        public int Age{ get;set; }                public Person(int age)
        {
            this.Age = age; 
        }
    }
}错误 1 “对象的引用.Person.Age.get”必须声明主体,因为它未标记为 abstract 或 extern E:\C#\对象的引用\对象的引用\Program.cs 25 25 对象的引用
错误 2 “对象的引用.Person.Age.set”必须声明主体,因为它未标记为 abstract 或 extern E:\C#\对象的引用\对象的引用\Program.cs 25 29 对象的引用
怎么解决啊,帮帮我吧  在线等!

解决方案 »

  1.   

    public int Age{ get;set; } 
    =>
     private int _Age; 
            public int Age
            {
                get
                {
                    return _Age;
                }
                set
                {
                    _Age= value;
                }
            }
      

  2.   

    可能你的.net版本3.0以前的,不支持自动属性,改成楼上的