Method FromJsonString
FromJsonString(string, TimeSpan, TimeSpan, RateBase)
Deserializes a JSON string to a Rate32OnTimeSpan instance.
public static Rate32OnTimeSpan FromJsonString(string rateHelperSerialized, TimeSpan minDelta, TimeSpan maxDelta, RateBase rateBase = RateBase.Second)
Parameters
rateHelperSerialized
stringSerialized Rate32OnTimeSpan instance.
minDelta
TimeSpanMinimum TimeSpan necessary between 2 counters when calculating a rate.
Counters will be buffered until this minimum delta is met.maxDelta
TimeSpanMaximum TimeSpan allowed between 2 counters when calculating a rate.
rateBase
RateBaseChoose whether the rate should be calculated per second, minute, hour or day.
Returns
- Rate32OnTimeSpan
If the
rateHelperSerialized
is valid, a new instance of the Rate32OnTimeSpan class with all data found inrateHelperSerialized
.
Otherwise, throws a JsonReaderException.
Exceptions
- JsonReaderException
rateHelperSerialized
is an invalid string representation of a Rate32OnTimeSpan instance.