ChronoField.GetFrom(ITemporalAccessor) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
从指定的临时对象中获取此字段的值。
[Android.Runtime.Register("getFrom", "(Ljava/time/temporal/TemporalAccessor;)J", "", ApiSince=26)]
public long GetFrom(Java.Time.Temporal.ITemporalAccessor? temporal);
[<Android.Runtime.Register("getFrom", "(Ljava/time/temporal/TemporalAccessor;)J", "", ApiSince=26)>]
abstract member GetFrom : Java.Time.Temporal.ITemporalAccessor -> int64
override this.GetFrom : Java.Time.Temporal.ITemporalAccessor -> int64
参数
- temporal
- ITemporalAccessor
要查询的临时对象,而不是 null
返回
此字段的值,而不是 null
实现
- 属性
注解
从指定的临时对象中获取此字段的值。 这会查询此字段值的临时对象。 使用此方法有两种等效的方法。 第一种方法是直接调用此方法。
// these two lines are equivalent, but the second approach is recommended
temporal = thisField.getFrom(temporal);
temporal = temporal.getLong(thisField);
建议使用第二种方法 getLong(TemporalField),因为代码中读取内容要清晰得多。 实现应使用 ChronoField 中可用的字段执行任何查询或计算。 如果不支持该字段,则必须引发 UnsupportedTemporalTypeException。
Java参考java.time.temporal.ChronoField.getFrom。