若要设置日期的最大值,请使用DateTime属性MaxValue。
DateTime max = DateTime.MaxValue;
现在,显示max的值以获取日期的最大值,如下所示。
using System;
using System.Linq;
public class Demo {
public static void Main() {
DateTime max = DateTime.MaxValue;
Console.WriteLine(max);
}
}输出结果
12/31/9999 11:59:59 PM