forked from ThatRendle/Simple.Data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRange.cs
More file actions
27 lines (24 loc) · 709 Bytes
/
Range.cs
File metadata and controls
27 lines (24 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Simple.Data
{
public static class Range
{
public static Range<T> to<T>(this T start, T end)
where T : IComparable<T>
{
return new Range<T>(start, end);
}
public static IRange to(this string start, string end)
{
DateTime startDate, endDate;
if (DateTime.TryParse(start, out startDate) && DateTime.TryParse(end, out endDate))
{
return new Range<DateTime>(startDate, endDate);
}
return new Range<string>(start, end);
}
}
}