Skip to main content

AggregationExtensions Class

Abblix.Oidc.Server

Abblix.Oidc.Server.Features.Licensing

AggregationExtensions Class

Provides extension methods for aggregating values from objects based on specific comparable properties.

public static class AggregationExtensions

Inheritance System.Object → AggregationExtensions

Methods

AggregationExtensions.Greater<T>(this Nullable<T>, Nullable<T>) Method

Determines the greater of two nullable values, treating null as positive infinity.

public static System.Nullable<T> Greater<T>(this System.Nullable<T> accumulatorValue, System.Nullable<T> currentValue)
where T : struct, System.IComparable<T>;

Type parameters

T

The type of the values being compared, constrained to value types that implement System.IComparable.

Parameters

accumulatorValue System.Nullable<T>

The first nullable value to compare.

currentValue System.Nullable<T>

The second nullable value to compare.

Returns

System.Nullable<T>
The greater of the two values if at least one is non-null; otherwise, null. If both values are non-null, the method returns null only if the currentValue is null, indicating it is considered as positive infinity.

Remarks

This method is useful in scenarios where you're aggregating a collection of nullable values and consider the absence of a value (null) as the highest possible value, allowing for custom maximum value logic.

AggregationExtensions.Join<T>(this HashSet<T>, HashSet<T>) Method

Combines the elements of two hash sets into a single set, including all unique elements from both.

public static System.Collections.Generic.HashSet<T>? Join<T>(this System.Collections.Generic.HashSet<T>? accumulator, System.Collections.Generic.HashSet<T>? current);

Type parameters

T

The type of elements in the hash sets.

Parameters

accumulator System.Collections.Generic.HashSet<T>

The first hash set.

current System.Collections.Generic.HashSet<T>

The second hash set to combine with the first.

Returns

System.Collections.Generic.HashSet<T>
A new hash set containing all unique elements from both input sets. If both inputs are null, returns null.

Remarks

This method provides a convenient way to merge two sets of elements, ensuring that the result contains all distinct elements from both sets. It is particularly useful for combining collections of unique items without duplicating any elements.

AggregationExtensions.Lesser<T>(this Nullable<T>, Nullable<T>) Method

Determines the lesser of two nullable values, treating null as negative infinity.

public static System.Nullable<T> Lesser<T>(this System.Nullable<T> currentValue, System.Nullable<T> accumulatorValue)
where T : struct, System.IComparable<T>;

Type parameters

T

The type of the values being compared, constrained to value types that implement System.IComparable<>.

Parameters

currentValue System.Nullable<T>

The first nullable value to compare.

accumulatorValue System.Nullable<T>

The second nullable value to compare.

Returns

System.Nullable<T>
The lesser of the two values if at least one is non-null; otherwise, null. If both values are non-null, the method returns null only if the accumulatorValue is null, indicating it is considered as negative infinity.

Remarks

This method supports scenarios requiring aggregation of a series of nullable values where the absence of a value (null) is interpreted as the lowest possible value, enabling custom minimum value logic.