Class BclConversions
Conversion methods which don't naturally fit into any other types - for example, for
enums which can't specify any other code. In most cases, conversions to and from BCL types
are provided within the type itself - such as ToDateTimeUnspecified()
and FromDateTime(DateTime).
Since 1.0.x
Availability net6.0, netstandard2.0
Inheritance
Object
BclConversions
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: NodaTime.Utility
Assembly: NodaTime.dll
Syntax
public static class BclConversions
Remarks
These methods are also available in the form of extension methods in the
NodaTime.Extensions
namespace.
Methods
ToDayOfWeek(IsoDayOfWeek)
Converts from the Noda Time IsoDayOfWeek enum to the equivalent BCL
System.DayOfWeek value. Other than Sunday, the BCL and ISO values are the same -
but ISO 8601 defines Sunday as day 7, and the BCL defines it as day 0.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static DayOfWeek ToDayOfWeek(IsoDayOfWeek isoDayOfWeek)
Parameters
Type | Name | Description |
---|---|---|
IsoDayOfWeek | isoDayOfWeek | ISO day of week value to convert. |
Returns
Type | Description |
---|---|
DayOfWeek | The ISO day of week value equivalent to the one passed in. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The isoDayOfWeek parameter
is not a valid day of the week. |
ToIsoDayOfWeek(DayOfWeek)
Converts from the BCL System.DayOfWeek enum to the equivalent Noda Time IsoDayOfWeek value.
Other than Sunday, the BCL and ISO values are the same - but ISO 8601 defines
Sunday as day 7, and the BCL defines it as day 0.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static IsoDayOfWeek ToIsoDayOfWeek(DayOfWeek dayOfWeek)
Parameters
Type | Name | Description |
---|---|---|
DayOfWeek | dayOfWeek | ISO day of week value to convert. |
Returns
Type | Description |
---|---|
IsoDayOfWeek | The BCL day of week value equivalent to the one passed in. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The dayOfWeek parameter
is not a valid day of the week. |