小编Con*_*acF的帖子

任何人都可以找出这个StackOverflowException的原因吗?

试图学习编程并再次失去信心,因为我认为我已经内化了一个简单的概念,但看起来非常特殊的东西正在发生,或者它只是飞过我的头脑.

当我运行程序时,如果通过为FirstName或SecondName分配字符串来访问该属性,则会出现StackOverFlowException

我的客户类别:

class Customer : ICustomer
{
    public string FirstName
    {
        get
        {
            return FirstName;
        }

        set
        {
            FirstName = value;
        }
    }

    public string fName
    {
        get
        {
            return fName;
        }

        set
        {
            fName = value;
        }
    }

    public string SecondName
    {
        get
        {
            return SecondName;
        }

        set
        {
            SecondName = value;
        }
    }

    public string sName
    {
        get
        {
            return sName;
        }

        set
        {
            sName = value;
        }
    }

    public int ID
    {
        get
        {
            return ID; …
Run Code Online (Sandbox Code Playgroud)

c# stack-overflow

0
推荐指数
1
解决办法
105
查看次数

标签 统计

c# ×1

stack-overflow ×1