ITemporalAmount.AddTo(ITemporal) Method

Definition

Adds to the specified temporal object.

[Android.Runtime.Register("addTo", "(Ljava/time/temporal/Temporal;)Ljava/time/temporal/Temporal;", "GetAddTo_Ljava_time_temporal_Temporal_Handler:Java.Time.Temporal.ITemporalAmountInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)]
public Java.Time.Temporal.ITemporal? AddTo (Java.Time.Temporal.ITemporal? temporal);
[<Android.Runtime.Register("addTo", "(Ljava/time/temporal/Temporal;)Ljava/time/temporal/Temporal;", "GetAddTo_Ljava_time_temporal_Temporal_Handler:Java.Time.Temporal.ITemporalAmountInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member AddTo : Java.Time.Temporal.ITemporal -> Java.Time.Temporal.ITemporal

Parameters

temporal
ITemporal

the temporal object to add the amount to, not null

Returns

an object of the same observable type with the addition made, not null

Attributes

Remarks

Adds to the specified temporal object.

Adds the amount to the specified temporal object using the logic encapsulated in the implementing class.

There are two equivalent ways of using this method. The first is to invoke this method directly. The second is to use Temporal#plus(TemporalAmount):

// These two lines are equivalent, but the second approach is recommended
              dateTime = amount.addTo(dateTime);
              dateTime = dateTime.plus(adder);

It is recommended to use the second approach, plus(TemporalAmount), as it is a lot clearer to read in code.

Java documentation for java.time.temporal.TemporalAmount.addTo(java.time.temporal.Temporal).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to