【发布时间】:2020-10-11 07:43:54
【问题描述】:
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;
}
}
}
}
}
这是我要运行的代码。我已经检查过,框架是一样的,这是对类似问题的回答。我正在使用 VS 代码并下载了所有必要的扩展。你知道是什么导致了这个错误吗?
找不到类型或命名空间名称“ArgumentЕxception”(您是否缺少 using 指令或程序集引用?)
【问题讨论】:
-
此文件顶部是否有
using System子句? -
是的,我把它放在最上面。这是我实现的唯一库。我应该添加其他库吗?
标签: c#