Table of Contents

ToTimeSpan Method

Definition

Namespace
Cuemon.Extensions
Assemblies
Cuemon.Extensions.Core.dll
Source
src/Cuemon.Extensions.Core/StringExtensions.cs

ToTimeSpan(string, TimeUnit)

Converts the specified value to its equivalent TimeSpan representation.

public static TimeSpan ToTimeSpan(this string value, TimeUnit timeUnit)

Parameters

value string

The string to extend.

timeUnit TimeUnit

One of the enumeration values that specifies the outcome of the conversion.

Returns

TimeSpan

A TimeSpan that corresponds to value from timeUnit.

Exceptions

ArgumentNullException

value is null.

OverflowException

The value paired with timeUnit is outside its valid range.

ArgumentOutOfRangeException

timeUnit was outside its valid range.