解决方案:
//主要用到向下兼容原理,DateTime?继承于DateTime; string req = "为字符串的参数"; DateTime? dt = null; DateTime? time = string.IsNullOrEmpty(req) ? dt : Convert.ToDateTime(req);