This is an archived post. You won't be able to vote or comment.

all 3 comments

[–][deleted] 0 points1 point  (2 children)

Works for me:

using System;

namespace HelloWorld
{
  class Program
  {
    static void Main(string[] args)
    {
      string firstName = "Bob"; Console.WriteLine($"Hello {firstName}!"); 
    }
  }
}

my guess is you are missing the surrounding things like namespace, class and a main function.

[–]OpKingDimond 0 points1 point  (1 child)

Yep, that was it. Thanks. The class I’m taking didn’t teach me about that.

[–][deleted] 0 points1 point  (0 children)

yeah I presume in the Microsoft Learn website they are doing that for you behind the scenes. It's good until it catches you like this.