C# Class Hourglass.Extensions.TimeSpanExtensions

Provides extensions methods for the TimeSpan struct.
Mostra file Open project: Dziemborowicz/Hourglass

Public Methods

Method Description
RoundDown ( this timeSpan ) : System.TimeSpan

Rounds a TimeSpan down to the nearest second.

RoundDown ( this timeSpan ) : TimeSpan?

Rounds a Nullable{TimeSpan} down to the nearest second.

RoundUp ( this timeSpan ) : System.TimeSpan

Rounds a TimeSpan up to the nearest second.

RoundUp ( this timeSpan ) : TimeSpan?

Rounds a Nullable{TimeSpan} up to the nearest second.

ToNaturalString ( this timeSpan ) : string

Converts the value of a TimeSpan object to its equivalent natural string representation.

ToNaturalString ( this timeSpan, IFormatProvider provider ) : string

Converts the value of a TimeSpan object to its equivalent natural string representation.

Private Methods

Method Description
GetStringWithUnits ( int value, string unit, IFormatProvider provider ) : string

Returns a string for the specified value with the specified unit (e.g., "5 minutes").

Method Details

RoundDown() public static method

Rounds a TimeSpan down to the nearest second.
public static RoundDown ( this timeSpan ) : System.TimeSpan
timeSpan this A .
return System.TimeSpan

RoundDown() public static method

Rounds a Nullable{TimeSpan} down to the nearest second.
public static RoundDown ( this timeSpan ) : TimeSpan?
timeSpan this A .
return TimeSpan?

RoundUp() public static method

Rounds a TimeSpan up to the nearest second.
public static RoundUp ( this timeSpan ) : System.TimeSpan
timeSpan this A .
return System.TimeSpan

RoundUp() public static method

Rounds a Nullable{TimeSpan} up to the nearest second.
public static RoundUp ( this timeSpan ) : TimeSpan?
timeSpan this A .
return TimeSpan?

ToNaturalString() public static method

Converts the value of a TimeSpan object to its equivalent natural string representation.
public static ToNaturalString ( this timeSpan ) : string
timeSpan this A .
return string

ToNaturalString() public static method

Converts the value of a TimeSpan object to its equivalent natural string representation.
public static ToNaturalString ( this timeSpan, IFormatProvider provider ) : string
timeSpan this A .
provider IFormatProvider An .
return string