1

I have this C# code:

public static void Main(string[] args)
{
    string os = System.OperatingSystem;
    Console.ForegroundColor = ConsoleColor.White;
    //..and more

and it says that "'System.OperatingSystem' is a 'type', which is not valid in the given context (CS0119)".So how to delete this error?

Maksim Simkin
  • 9,561
  • 4
  • 36
  • 49
JetFly
  • 113
  • 1
  • 6

1 Answers1

3

System.OperatingSystem is a type, you couldn't asign it to a variable. What do you want to achieve? Name of running operating system? You could do it with:

Environment.OSVersion.ToString()
Maksim Simkin
  • 9,561
  • 4
  • 36
  • 49