Table of Contents

Method FromJsonString

Namespace
Skyline.DataMiner.Utils.Rates.Common
Assembly
Skyline.DataMiner.Utils.Rates.Common.dll

FromJsonString(string, TimeSpan, TimeSpan, RateBase, double?)

Deserializes a JSON String to a Rate32OnTimeSpan instance.

public static Rate32OnTimeSpan FromJsonString(string rateHelperSerialized, TimeSpan minDelta, TimeSpan maxDelta, RateBase rateBase = RateBase.Second, double? overrideNegativeRatesWith = null)

Parameters

rateHelperSerialized string

Serialized Rate32OnTimeSpan instance.

minDelta TimeSpan

Minimum TimeSpan necessary between 2 counters when calculating a rate.
Counters will be buffered until this minimum delta is met.

maxDelta TimeSpan

Maximum TimeSpan allowed between 2 counters when calculating a rate.

rateBase RateBase

Choose whether the rate should be calculated per second, minute, hour or day.

overrideNegativeRatesWith double?

Optional. When provided, a negative rate is replaced by this value and the buffered counters are restarted from the new counter. Meant for use cases where a negative rate is unexpected and undesired (e.g. caused by a counter reset or a device bug). When null (default), negative rates are returned as calculated.

Returns

Rate32OnTimeSpan

If the rateHelperSerialized is valid, a new instance of the Rate32OnTimeSpan class with all data found in rateHelperSerialized.
Otherwise, throws a JsonReaderException.

Exceptions

JsonReaderException

rateHelperSerialized is an invalid string representation of a Rate32OnTimeSpan instance.

Advanced search syntax