using System; class Example { static void Main() { Console.WriteLine("Hello, world!"); } }
using System; class Example { static void Main() { DateTime today = DateTime.Today; Console.WriteLine("Today is {0}", today.ToShortDateString()); } }
using System; class Example { static void Main() { Console.WriteLine("Operating system: {0}", Environment.OSVersion); Console.WriteLine("Machine name: {0}", Environment.MachineName); } }This code uses the Environment class from the System namespace to retrieve information about the current operating system and machine name, and display it to the console. Package library: This is part of the .NET Framework/System.Runtime.InteropServices package library.