Search code examples
c#consoleinternals

error CS0246: The type or namespace name 'Internal' could not be found


I was trying to get the vscode console to output Hello using the code below, but instead I got an error

Looking at the code in the script it doesn't have any problem, and even registers Console as a Class and WriteLine as a Method. I think it's saying I didn't reference the Internal namespace even though I did reference it.My Code(https://i.sstatic.net/fqr3V.png)

I have the console set to internalconsole and tried the other options but none of them worked either. I have also tried using both namespaces together but got the same error.

using Internal;
namespace Program001
{
    internal class Myclass
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello");
        }
    }
}

I'm not sure exactly what went wrong at this point. here is the full error:

Error: Specified file could not be compiled.
Program001.cs(1,7): error CS0246:  The type or namespace name 'Internal' could not be found (are you missing a using directive or an assembly reference?) 

Solution

  • I now understand this question was more of a misunderstanding on my part.

    The Reason I had thought I was better off with the Internal namespace was because when I was using the System namespace the WriteLine Method in vscode was not highlighted as a Method,
    but when I used the Internal namespace the WriteLine Method was highlighted properly, so I had thought I should use the Internal namespace.

    summary: I had thought I should use the Internal namespace, but should have used the system namespace instead.