There are a few issues here. First, your class is called DateTime
, which is causing the compiler to confuse it with System.DateTime
. Also make sure the System
namespace is available with a using
directive, or fully-qualifying the type. Thirdly, C# is case sensitive. It should be Now
, not now
. Try giving things different names:
using System;
namespace MyNamespace
{
class MyClass
{
public static void Main()
{
DateTime now = DateTime.Now;
Console.WriteLine(now);
Console.ReadLine();
}
}
}