2

Part Of My Code:

 public void Move(Point newLocation)
    {
        if (newLocation == null)
            throw new ArgumentNullException("newLocation");

        Move(newLocation.X, newLocation.Y);
    }

I get this as a Error:

The type or namespace name 'ArgumentNullException' could not be found (are you missing a using directive or an assembly reference?)

Is there something wrong with my c# code. Could this be a VS Code C# support extension bug?

I am a beginner to c# please explain

1 Answers1

1

ArgumentNullException is in the "System" namespace. So either fully-qualify the name,

throw new System.ArgumentNullException("newLocation");

or add

using System;

to the top of your C# file or your namespace.

David Browne - Microsoft
  • 80,331
  • 6
  • 39
  • 67