语言

ITemporalAmount.AddTo(ITemporal) 方法

定义

添加到指定的临时对象。

[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

参数

temporal
ITemporal

要向其添加量而不是 null 的临时对象

返回

具有添加的相同可观察类型的对象,而不是 null

特性

注解

添加到指定的临时对象。

使用封装在实现类中的逻辑将量添加到指定的临时对象。

使用此方法有两种等效的方法。 第一种方法是直接调用此方法。 第二种是使用 Temporal#plus(TemporalAmount):

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

建议使用第二种方法, plus(TemporalAmount)因为在代码中读取内容要清晰得多。

适用于 . 的 java.time.temporal.TemporalAmount.addTo(java.time.temporal.Temporal)Java 文档

本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。

适用于