Struct UQueryState<T>
Query object containing all the selection rules. The object can be saved and rerun later without re-allocating memory.
Syntax
public struct UQueryState<T> : IEnumerable<T>, IEquatable<UQueryState<T>> where T : VisualElement
Type Parameters
Methods
AtIndex(Int32)
Selects the nth element matching all the criteria, or null if not enough elements were found.
Declaration
public T AtIndex(int index)
Parameters
Type |
Name |
Description |
Int32 |
index |
The index of the matched element.
|
Returns
Type |
Description |
T |
The match element at the specified index.
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
Equals(UQueryState<T>)
Declaration
public bool Equals(UQueryState<T> other)
Parameters
Returns
First()
The first element matching all the criteria, or null if none was found.
Declaration
Returns
Type |
Description |
T |
The first element matching all the criteria, or null if none was found.
|
ForEach(Action<T>)
Invokes function on all elements matching the query.
Declaration
public void ForEach(Action<T> funcCall)
Parameters
Type |
Name |
Description |
Action<T> |
funcCall |
The action to be invoked with each matching element.
|
ForEach<T2>(Func<T, T2>)
Invokes function on all elements matching the query.
Declaration
public List<T2> ForEach<T2>(Func<T, T2> funcCall)
Parameters
Type |
Name |
Description |
Func<T, T2> |
funcCall |
The action to be invoked with each matching element.
|
Returns
Type |
Description |
List<T2> |
|
Type Parameters
ForEach<T2>(List<T2>, Func<T, T2>)
Invokes function on all elements matching the query.
Declaration
public void ForEach<T2>(List<T2> result, Func<T, T2> funcCall)
Parameters
Type |
Name |
Description |
List<T2> |
result |
Each return value will be added to this list.
|
Func<T, T2> |
funcCall |
The function to be invoked with each matching element.
|
Type Parameters
GetEnumerator()
Allows traversing the results of the query with foreach
without creating GC allocations.
Declaration
public UQueryState<T>.Enumerator GetEnumerator()
Returns
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Last()
The last element matching all the criteria, or null if none was found.
Declaration
Returns
Type |
Description |
T |
The last element matching all the criteria, or null if none was found.
|
RebuildOn(VisualElement)
Creates a new QueryState with the same selection rules, applied on another VisualElement.
Declaration
public UQueryState<T> RebuildOn(VisualElement element)
Parameters
Type |
Name |
Description |
VisualElement |
element |
The element on which to apply the selection rules.
|
Returns
Type |
Description |
UQueryState<T> |
A new QueryState with the same selection rules, applied on this element.
|
ToList()
Returns a list containing elements satisfying selection rules.
Declaration
Returns
Type |
Description |
List<T> |
A list containing elements satisfying selection rules.
|
ToList(List<T>)
Adds all elements satisfying selection rules to the list.
Declaration
public void ToList(List<T> results)
Parameters
Type |
Name |
Description |
List<T> |
results |
Adds all elements satisfying selection rules to the list.
|
Operators
Equality(UQueryState<T>, UQueryState<T>)
Declaration
public static bool operator ==(UQueryState<T> state1, UQueryState<T> state2)
Parameters
Returns
Inequality(UQueryState<T>, UQueryState<T>)
Declaration
public static bool operator !=(UQueryState<T> state1, UQueryState<T> state2)
Parameters
Returns