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