小编Mar*_*ski的帖子

使用 ArgumentException 时出现错误,调用程序集引用,这是什么?

using System;

namespace Exercise
{
    public abstract class Gun
    {
        public Gun(string name, int bullets)
        {
        }

        public string Name { get; set; }

        public int Bullets
        {
            get { return Bullets; }
            set 
            {
                if (value < 0)
                {
                    throw new Argument?xception("Bullets cannot be below 0");
                }
                else
                {
                    Bullets = value;
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我试图运行的代码。我已经检查过,框架是一样的,这是对类似问题的回答。我正在使用 VS 代码并下载了所有必要的扩展。你知道是什么导致了这个错误吗?

找不到类型或命名空间名称“Argument?xception”(您是否缺少 using 指令或程序集引用?)

c#

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

标签 统计

c# ×1