编辑代码

using System;



public class HelloWorld
{
    public static void Main()
    { 
       String str="";
       if (String.IsNullOrEmpty(str)) {
           Console.WriteLine("Null or empty.");
       } else {
            var parsedDate = DateTime.ParseExact(str, "yyyy-MM-dd",null);
            Console.WriteLine(parsedDate);

       }
       
    }
}