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 net35-Client, PCL
Inheritance
Object
BclConversions
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: NodaTime.Utility
Assembly: NodaTime.dll
Syntax
public static class BclConversions
Remarks
Many of the methods within this class could be expressed as extension methods - but currently
Noda Time always builds against .NET 2. In a future version, there may be multiple build targets,
allowing these to become extension methods for the builds which use .NET 3.5 and higher.
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 net35-Client, PCL
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 net35-Client, PCL
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. |