What is the point of Convert.ToDateTime(bool)?

后端 未结 3 883
时光取名叫无心
时光取名叫无心 2020-12-20 11:42

I was doing some type conversion routines last night for a system I am working on. One of the conversions involves turning string values into their DateTime equivalents.

3条回答
  •  难免孤独
    2020-12-20 11:57

    If you look closely, most of the overloads are invalid and will throw an InvalidCastException.

    It has to implement all of the casts as it implements IConvertible and this is the only way to do it correctly.

提交回复
热议问题