# Aggregator<T, U>.TryAggregate Method

## Definition

Namespace: Extreme.DataAnalysis
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23

 TryAggregate(ReadOnlySpan, U) Aggregates the elements of a vector and returns the result. TryAggregate(Vector, U) Aggregates the elements of a vector and returns the result. TryAggregate(IEnumerable, Boolean, U) Aggregates the elements of a sequence and returns the result. TryAggregate(ReadOnlySpan, Int32, U) Aggregates the elements of a vector and returns the result. TryAggregate(ReadOnlySpan, Int32, Func, U) Aggregates the elements of a vector and returns the result. TryAggregate(Vector, Array1D, Int32, U) Aggregates the specified elements of a vector and returns the result. TryAggregate(Vector, Int32, Int32, U) Aggregates the specified range of elements of a vector and returns the result. TryAggregate(ReadOnlySpan, Int32, ReadOnlySpan, Int32, U) Aggregates the elements of a vector and returns the result.

Aggregates the elements of a vector and returns the result.
C#
``````public virtual bool TryAggregate(
out U result
)``````

#### Parameters

result  U
The result of the aggregation.

#### Return Value

Boolean
true if the aggregation produced a result; otherwise false.

## Aggregator<T, U>.TryAggregate(Vector<T>, U)

Aggregates the elements of a vector and returns the result.
C#
``````public abstract bool TryAggregate(
Vector<T> values,
out U result
)``````

#### Parameters

values  Vector<T>
A vector of values.
result  U
The result of the aggregation.

#### Return Value

Boolean
true if the aggregation produced a result; otherwise false.

## Aggregator<T, U>.TryAggregate(IEnumerable<T>, Boolean, U)

Aggregates the elements of a sequence and returns the result.
C#
``````public virtual bool TryAggregate(
IEnumerable<T> values,
bool checkForMissingValues,
out U result
)``````

#### Parameters

values  IEnumerable<T>
A sequence of values.
checkForMissingValues  Boolean
Indicates whether missing values should be filtered from the sequence.
result  U
The result of the aggregation.

#### Return Value

Boolean
true if the aggregation produced a result; otherwise false.

Aggregates the elements of a vector and returns the result.
C#
``````public abstract bool TryAggregate(
int stride,
out U result
)``````

#### Parameters

stride  Int32

result  U
The result of the aggregation.

#### Return Value

Boolean
true if the aggregation produced a result; otherwise false.

## Aggregator<T, U>.TryAggregate(ReadOnlySpan<T>, Int32, Func<T, Boolean>, U)

Aggregates the elements of a vector and returns the result.
C#
``````public abstract bool TryAggregate(
int stride,
Func<T, bool> predicate,
out U result
)``````

#### Parameters

stride  Int32

predicate  Func<T, Boolean>

result  U
The result of the aggregation.

#### Return Value

Boolean
true if the aggregation produced a result; otherwise false.

## Aggregator<T, U>.TryAggregate(Vector<T>, Array1D<Int32>, Int32, U)

Aggregates the specified elements of a vector and returns the result.
C#
``````public virtual bool TryAggregate(
Vector<T> values,
Array1D<int> indexes,
int length,
out U result
)``````

#### Parameters

values  Vector<T>
A vector of values.
indexes  Array1D<Int32>
An integer array containing the indexes of the elements of values that will be aggregated.
length  Int32
The number of values to aggregate.
result  U
The result of the aggregation.

#### Return Value

Boolean
true if the aggregation produced a result; otherwise false.

## Aggregator<T, U>.TryAggregate(Vector<T>, Int32, Int32, U)

Aggregates the specified range of elements of a vector and returns the result.
C#
``````public virtual bool TryAggregate(
Vector<T> values,
int startIndex,
int endIndex,
out U result
)``````

#### Parameters

values  Vector<T>
A vector of values.
startIndex  Int32
The zero-based index of the first element in values that should be aggregated.
endIndex  Int32
The zero-based index of the last element in values that should be aggregated.
result  U
The result of the aggregation.

#### Return Value

Boolean
true if the aggregation produced a result; otherwise false.

Aggregates the elements of a vector and returns the result.
C#
``````public abstract bool TryAggregate(
int stride,
out U result
)``````

stride  Int32