Class PeriodBuilder
A mutable builder class for
Period values. Each property can
be set independently, and then a Period can be created from the result
using the
Build() method.
Inheritance
PeriodBuilder
Assembly: NodaTime.dll
Syntax
public sealed class PeriodBuilder : IXmlSerializable
Constructors
PeriodBuilder()
Creates a new period builder with an initially zero period.
Declaration
PeriodBuilder(Period)
Creates a new period builder with the values from an existing
period. Calling this constructor instead of
ToBuilder()
allows object initializers to be used.
Declaration
public PeriodBuilder(Period period)
Parameters
Type |
Name |
Description |
Period |
period |
An existing period to copy values from. |
Exceptions
Properties
Days
Gets or sets the number of days within the period.
Declaration
public long Days { get; set; }
Property Value
Hours
Gets or sets the number of hours within the period.
Declaration
public long Hours { get; set; }
Property Value
Item[PeriodUnits]
Gets or sets the value of a single unit.
Declaration
public long this[PeriodUnits unit] { get; set; }
Parameters
Property Value
Type |
Description |
Int64 |
The value of the given unit within this period builder, or zero if the unit is unset. |
Exceptions
Milliseconds
Gets or sets the number of milliseconds within the period.
Declaration
public long Milliseconds { get; set; }
Property Value
Minutes
Gets or sets the number of minutes within the period.
Declaration
public long Minutes { get; set; }
Property Value
Months
Gets or sets the number of months within the period.
Declaration
public long Months { get; set; }
Property Value
Seconds
Gets or sets the number of seconds within the period.
Declaration
public long Seconds { get; set; }
Property Value
Ticks
Gets or sets the number of ticks within the period.
Declaration
public long Ticks { get; set; }
Property Value
Weeks
Gets or sets the number of weeks within the period.
Declaration
public long Weeks { get; set; }
Property Value
Years
Gets or sets the number of years within the period.
Declaration
public long Years { get; set; }
Property Value
Methods
Build()
Builds a period from the properties in this builder.
Declaration
Returns
Type |
Description |
Period |
A period containing the values from this builder. |
Explicit Interface Implementations
IXmlSerializable.GetSchema()
Declaration
XmlSchema IXmlSerializable.GetSchema()
Returns
IXmlSerializable.ReadXml(XmlReader)
Declaration
void IXmlSerializable.ReadXml(XmlReader reader)
Parameters
IXmlSerializable.WriteXml(XmlWriter)
Declaration
void IXmlSerializable.WriteXml(XmlWriter writer)
Parameters
Implements