This is because your namespace is already called DateTime , which collides with an existing class name. So you can:
namespace DateTime { using System; using System.Text; class Program { static void Main(string[] args) { Console.WriteLine("The current date and time is " + DateTime.Now); } } }
or find the best naming convention for your own namespaces that I would recommend you do:
using System; using System.Text; namespace MySuperApplication { class Program { static void Main(string[] args) { Console.WriteLine("The current date and time is " + DateTime.Now); } } }
source share