-1

Hey Im very new to C# so in my Programming course the teacher creats a new class. This wasnt working in my Version of VS Code so i createt a new File and Named it Human.cs But in the Main-Methode it cant resolve the class. Heres my Code:

using System;

namespace Udemy_21
{
   class Program
   {
    static void Main(string[] args)
    {

        // Create Obejekt Human Class

        Human human = new Human();

        

        Console.WriteLine("Hello World!");
     }
   }
}

The second code:

using System;
using System.Collections.Generic;
using System.Text;

namespace Udemy_21
{
    // Blaupause für Datentyp
    class Human
    {
    // Membervariable: Vorname
    public string firstname;

    // Member Methode
    public void IntroduceMyself() 
    {
        System.Console.WriteLine("Hi ich bin, {0}", firstname);
    }
  }
}

An heres a picture of VS code:

VS Code error

Jonathan
  • 76
  • 7

1 Answers1

0

I think the problem here is that you need to include the class. Check this answer to a very similar question and see if it works for you. You also should use Visual Studio when working with C#.

Edgedancer
  • 127
  • 9