为什么 c#编译器无法接受:
string propValue = "2017/12/01";
object propObjValue = null;
DateTime.TryParse(propValue, out propObjValue);
编译错误:参数2:无法从'out object'转换为'out System.DateTime'
然而它确实接受:
string propValue = "2017/12/01";
object propObjValue = null;
propObjValue = DateTime.Parse(propValue);
这是等效的,除了第二种方法我需要尝试/ catch以避免解析问题。