共用方式為


ITemporalAccessor.Query(ITemporalQuery) Method

Definition

Queries this date-time.

[Android.Runtime.Register("query", "(Ljava/time/temporal/TemporalQuery;)Ljava/lang/Object;", "GetQuery_Ljava_time_temporal_TemporalQuery_Handler:Java.Time.Temporal.ITemporalAccessor, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)]
[Java.Interop.JavaTypeParameters(new System.String[] { "R" })]
public virtual Java.Lang.Object? Query (Java.Time.Temporal.ITemporalQuery? query);
[<Android.Runtime.Register("query", "(Ljava/time/temporal/TemporalQuery;)Ljava/lang/Object;", "GetQuery_Ljava_time_temporal_TemporalQuery_Handler:Java.Time.Temporal.ITemporalAccessor, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "R" })>]
abstract member Query : Java.Time.Temporal.ITemporalQuery -> Java.Lang.Object
override this.Query : Java.Time.Temporal.ITemporalQuery -> Java.Lang.Object

Parameters

query
ITemporalQuery

the query to invoke, not null

Returns

the query result, null may be returned (defined by the query)

Attributes

Remarks

Queries this date-time.

This queries this date-time using the specified query strategy object.

Queries are a key tool for extracting information from date-times. They exists to externalize the process of querying, permitting different approaches, as per the strategy design pattern. Examples might be a query that checks if the date is the day before February 29th in a leap year, or calculates the number of days to your next birthday.

The most common query implementations are method references, such as LocalDate::from and ZoneId::from. Additional implementations are provided as static methods on TemporalQuery.

Java documentation for java.time.temporal.TemporalAccessor.query(java.time.temporal.TemporalQuery<R>).

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