-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathSortKeyValue.cs
44 lines (39 loc) · 1.16 KB
/
SortKeyValue.cs
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
namespace DB_Schema_Export_Tool
{
internal class SortKeyValue
{
/// <summary>
/// True if the value is a number (integer or double)
/// </summary>
public bool IsNumeric { get; set; }
/// <summary>
/// Numeric value
/// </summary>
public double NumericValue { get; set; }
/// <summary>
/// Value
/// </summary>
public string Value { get; set; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="value">Value for this sort key</param>
/// <param name="isNumeric">When true, try to convert it to a double</param>
public SortKeyValue(string value, bool isNumeric)
{
Value = value;
IsNumeric = isNumeric;
if (isNumeric && double.TryParse(value, out var numericValue))
{
NumericValue = numericValue;
}
}
/// <summary>
/// Show the sort key value
/// </summary>
public override string ToString()
{
return Value;
}
}
}