Skip to content

Commit 7ac6ff7

Browse files
committed
Pattern matching for code readability
1 parent eb94e76 commit 7ac6ff7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

CsvExport/CsvExport.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@ public static string MakeValueCsvFriendly(object value, string columnSeparator =
158158
if (value is INullable && ((INullable)value).IsNull) return "";
159159

160160
string output;
161-
if (value is DateTime)
161+
if (value is DateTime date)
162162
{
163-
if (((DateTime)value).TimeOfDay.TotalSeconds == 0)
163+
if (date.TimeOfDay.TotalSeconds == 0)
164164
{
165-
output = ((DateTime)value).ToString("yyyy-MM-dd");
165+
output = date.ToString("yyyy-MM-dd");
166166
}
167167
else
168168
{
169-
output = ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss");
169+
output = date.ToString("yyyy-MM-dd HH:mm:ss");
170170
}
171171
}
172172
else

0 commit comments

Comments
 (0)