提交 a42a1651 编写于 作者: A Andrey Akinshin 提交者: Rob LaDuca

Better TimeSpan comparison with zero (#69)

It's a bad practice to compare double values with zero.
A better way to compare TimeSpan with zero is using TimeSpan.Zero.
上级 a1142b14
......@@ -124,7 +124,7 @@ public override string ConvertToString(object value, IValueSerializerContext con
// Build up the format string to be used in DateTime.ToString()
StringBuilder formatString = new StringBuilder("yyyy-MM-dd");
if (dateTime.TimeOfDay.TotalSeconds == 0)
if (dateTime.TimeOfDay == TimeSpan.Zero)
{
// The time portion of this DateTime is exactly at midnight.
// We don't include the time component if the Kind is unspecified.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册