C# 总是在set处抛出 system stack over flow exception的异

时间:2019-05-18 05:20来源:计算机教程
namespace ConsoleApp1 {         class Program     {         static void Main(string[] args)         {             People tom = new People() ;             tom.Name =" Tom";            

namespace ConsoleApp1

{

   

    class Program

    {

        static void Main(string[] args)

        {

            People tom = new People() ;

            tom.Name =" Tom";

            tom.Age = 18;

            tom.MyPlace = Console.ReadLine();

            Console.WriteLine(tom.MyPlace);

vnsc5858威尼斯城官网,            Console.ReadKey();

         }

    }

public class People

    {

        public string Name;

        public int Age;

        public string MyPlace

        {

            get

            {

                return MyPlace;

            }

            set

            {

                if (value == "北京")

                {

                    MyPlace = value;

                }

                else

                {

                    MyPlace = "不符合要求";

                }

            }

        }

}

}

编辑:计算机教程 本文来源:C# 总是在set处抛出 system stack over flow exception的异

关键词: