关于对象属性的问题,代码不知道写错了没?

using System;

namespace test
{

class Program
{
    public static void Main(string[] args)
    {
        Console.WriteLine("Hello World!");
        
        test hhh = new test();
        hhh.abc="hahaha";
        

        Console.Write(hhh.abc);
        Console.ReadKey();
    }
}


public  class test
{
    public string abc
    {
        get
        {return abc;}
        
        set
        {abc=value ;}
    }

}

}


运行提示停止运行,是我写错了吗?

阅读 2.3k
1 个回答
public  class test
{
    string _abc;
    public string abc
    {
        get
        {return _abc;}
        
        set
        {_abc=value ;}
    }

}

你没发现属性abc在循环调用自己吗?