Class TimeSpanExtensions
Extension methods for System.TimeSpan.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Inheritance
Object
    TimeSpanExtensions
  Inherited Members
      Object.ToString()
    
    
      Object.Equals(Object)
    
    
      Object.Equals(Object, Object)
    
    
      Object.ReferenceEquals(Object, Object)
    
    
      Object.GetHashCode()
    
    
      Object.GetType()
    
    
      Object.MemberwiseClone()
    
  Namespace: NodaTime.Extensions
Assembly: NodaTime.dll
Syntax
public static class TimeSpanExtensions
  Methods
ToDuration(TimeSpan)
Converts a System.TimeSpan into a Duration.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
public static Duration ToDuration(this TimeSpan timeSpan)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TimeSpan | timeSpan | The TimeSpan to convert. | 
      
Returns
| Type | Description | 
|---|---|
| Duration | A Duration representing the same length of time as timeSpan. | 
      
Remarks
This is a convenience method which calls FromTimeSpan(TimeSpan).
  
  ToOffset(TimeSpan)
Converts a System.TimeSpan into an Offset.
  
  
  Since 2.0.x
  
  
  Availability net45, netstandard1.3
  
  Declaration
public static Offset ToOffset(this TimeSpan timeSpan)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TimeSpan | timeSpan | The TimeSpan to convert. | 
      
Returns
| Type | Description | 
|---|---|
| Offset | An Offset representing the same length of time as timeSpan. | 
      
Remarks
This is a convenience method which calls FromTimeSpan(TimeSpan).
  Exceptions
| Type | Condition | 
|---|---|
| ArgumentOutOfRangeException | timeSpan is too large or small to
    be represented as an Offset. |