我的代码的一部分:
public void Move(Point newLocation)
{
if (newLocation == null)
throw new ArgumentNullException("newLocation");
Move(newLocation.X, newLocation.Y);
}
我得到这个错误:
找不到类型或命名空间名称"参数空异常"(您是否缺少 using 指令或 程序集引用?
我的 c# 代码有问题吗?这可能是 VS Code C# 支持扩展错误吗?
我是 c# 的初学者,请解释一下
ArgumentNullException 位于 "System" 命名空间中。 所以要么完全限定这个名字,
throw new System.ArgumentNullException("newLocation");
或添加
using System;
到 C# 文件或命名空间的顶部。