PeriodBuilder.Item Property
Definition
Namespace: Corvus.Text.Json
Assembly: Corvus.Text.Json.dll
Source: PeriodBuilder.cs
this[PeriodUnits]
Gets or sets the value of a single unit.
public long this[PeriodUnits unit] { get; set; }
Parameters
| Name | Type | Description |
|---|---|---|
unit |
PeriodUnits |
A single value within the PeriodUnits enumeration. |
Returns
Property Value
The value of the given unit within this period builder, or zero if the unit is unset.
Exceptions
| Exception | Description |
|---|---|
ArgumentOutOfRangeException |
unit is not a single unit, or a value is provided for a date unit which is outside the range of Int32. |
Remarks
The type of this indexer is Int64 for uniformity, but any date unit (year, month, week, day) will only ever have a value in the range of Int32. For the Nanoseconds unit, the value is converted to Int64 when reading from the indexer, causing it to fail if the value is out of range (around 250 years). To access the values of very large numbers of nanoseconds, use the Nanoseconds property directly.
Applies To
| Product | Versions |
|---|---|
| .NET | 9, 10 |
| .NET Standard | 2.0, 2.1 |
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests.
Open an issue