Noda Time
Show / Hide Table of Contents

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.
Since 1.0.x
Availability net35-Client
Inheritance
Object
PeriodBuilder
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: NodaTime
Assembly: NodaTime.dll
Syntax
public sealed class PeriodBuilder

Constructors

PeriodBuilder()

Creates a new period builder with an initially zero period.
Since 1.0.x
Availability net35-Client
Declaration
public PeriodBuilder()

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.
Since 1.0.x
Availability net35-Client
Declaration
public PeriodBuilder(Period period)
Parameters
Type Name Description
Period period An existing period to copy values from.
Exceptions
Type Condition
System.ArgumentNullException period is null

Properties

Days

Gets or sets the number of days within the period.
Since 1.0.x
Availability net35-Client
Declaration
public long Days { get; set; }
Property Value
Type Description
Int64

Hours

Gets or sets the number of hours within the period.
Since 1.0.x
Availability net35-Client
Declaration
public long Hours { get; set; }
Property Value
Type Description
Int64

Item[PeriodUnits]

Gets or sets the value of a single unit.
Since 1.0.x
Availability net35-Client
Declaration
public long this[PeriodUnits unit] { get; set; }
Parameters
Type Name Description
PeriodUnits unit A single value within the PeriodUnits enumeration.
Property Value
Type Description
Int64 The value of the given unit within this period builder, or zero if the unit is unset.
Exceptions
Type Condition
ArgumentOutOfRangeException unit is not a single unit

Milliseconds

Gets or sets the number of milliseconds within the period.
Since 1.0.x
Availability net35-Client
Declaration
public long Milliseconds { get; set; }
Property Value
Type Description
Int64

Minutes

Gets or sets the number of minutes within the period.
Since 1.0.x
Availability net35-Client
Declaration
public long Minutes { get; set; }
Property Value
Type Description
Int64

Months

Gets or sets the number of months within the period.
Since 1.0.x
Availability net35-Client
Declaration
public long Months { get; set; }
Property Value
Type Description
Int64

Seconds

Gets or sets the number of seconds within the period.
Since 1.0.x
Availability net35-Client
Declaration
public long Seconds { get; set; }
Property Value
Type Description
Int64

Ticks

Gets or sets the number of ticks within the period.
Since 1.0.x
Availability net35-Client
Declaration
public long Ticks { get; set; }
Property Value
Type Description
Int64

Weeks

Gets or sets the number of weeks within the period.
Since 1.0.x
Availability net35-Client
Declaration
public long Weeks { get; set; }
Property Value
Type Description
Int64

Years

Gets or sets the number of years within the period.
Since 1.0.x
Availability net35-Client
Declaration
public long Years { get; set; }
Property Value
Type Description
Int64

Methods

Build()

Builds a period from the properties in this builder.
Since 1.0.x
Availability net35-Client
Declaration
public Period Build()
Returns
Type Description
Period A period containing the values from this builder.
In this article
Back to top Generated by DocFX