C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
RunTime.cs
Go to the documentation of this file.
1using System;
2
3namespace AnalyzeRe
4{
9 public class RunTime
10 {
14 private double? _value;
15
16 private RunTime(double? value)
17 {
18 _value = value;
19 }
25 public override string ToString()
26 {
27 if (!HasValue)
28 return string.Empty;
29 return TimeSpan.FromSeconds(Value).ToString("h'h 'm'm 's'.'fff's'");
30 }
31
35 public static implicit operator double(RunTime d) => d._value.Value;
36
40 public static implicit operator RunTime(double? b) => new RunTime(b);
41
45 public static implicit operator string(RunTime d) => d.ToString();
46
51 public double Value => _value.Value;
52
56 public bool HasValue => _value.HasValue;
57
61 public bool Equals(RunTime other) => ReferenceEquals(this, other) ||
62 other != null && other.HasValue &&
63 Equals(_value, other.Value);
64 }
65}
User-friendly representation of the numeric optimization runtime_seconds field. Wraps a nullable doub...
Definition RunTime.cs:10
override string ToString()
ToString() method override. Example: for double value 33.456 the formatted string will be "0h 0m 33....
Definition RunTime.cs:25
double Value
Gets the double value of the current RunTime object if the HasValue property is true....
Definition RunTime.cs:51
bool HasValue
Gets a bool value indicating whether the object has a valid double value.
Definition RunTime.cs:56
bool Equals(RunTime other)
Returns a value indicating whether this instance value is equal to another RunTime object value.