Generated by DocFX

Class GeneralComparer<T>

General comparer which supports multiple sorting directions.

Inheritance
System.Object
GeneralComparer<T>
Namespace: ISynergy.Framework.Mathematics.Comparers
Assembly: ISynergy.Framework.Mathematics.dll
Syntax
public class GeneralComparer<T> : IComparer<T> where T : IComparable<T>
Type Parameters
Name Description
T
Examples
// Assume we have values to sort
double[] values = { 0, -5, 3, 1, 8 };

// We can create an ad-hoc sorting rule
Array.Sort(values, new GeneralComparer<double>(ComparerDirection.Descending));

// Result will be { 8, 5, 3, 1, 0 }.

Constructors

View Source

GeneralComparer(ComparerDirection)

Constructs a new General Comparer.

Declaration
public GeneralComparer(ComparerDirection direction)
Parameters
Type Name Description
ComparerDirection direction

The direction to compare.

Properties

View Source

Direction

Gets or sets the sorting direction used by this comparer.

Declaration
public ComparerDirection Direction { get; set; }
Property Value
Type Description
ComparerDirection

Methods

View Source

Compare(T, T)

Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.

Declaration
public int Compare(T x, T y)
Parameters
Type Name Description
T x

The first object to compare.

T y

The second object to compare.

Returns
Type Description
System.Int32

Extension Methods

Matrix.Replace<T>(T, Object, Object)
Matrix.IsEqual(Object, Object, Decimal, Decimal)
EntityBaseExtensions.HasProperty(Object, String)
ArrayExtensions.Concatenate<T>(T, T[])
CollectionExtensions.FromHierarchy<TSource>(TSource, Func<TSource, TSource>, Func<TSource, Boolean>)
CollectionExtensions.FromHierarchy<TSource>(TSource, Func<TSource, TSource>)
ObjectExtensions.Clone<T>(T)
ObjectExtensions.To<T>(Object)
ObjectExtensions.To(Object, Type)
ObjectExtensions.HasMethod(Object, String)
ObjectExtensions.AddressOf<T>(T)
ReflectionExtensions.GetIdentityValue<T>(T)
ReflectionExtensions.GetIdentityValue<T, TResult>(T)
ReflectionExtensions.GetIdentityProperty<T>(T)
ReflectionExtensions.HasIdentityProperty<T>(T)
ReflectionExtensions.GetPropertyValue<T, TResult>(T, String, TResult)
ReflectionExtensions.GetPropertyInfo<T, TValue>(T, Expression<Func<T, TValue>>)
ReflectionExtensions.GetTitleValue<T>(T)
ReflectionExtensions.HasParentIdentityProperty<T>(T)
ReflectionExtensions.GetParentIdentityProperty<T>(T)
ReflectionExtensions.IsFreeApplication<T>(T)

See Also

ElementComparer<T>
ArrayComparer<T>
GeneralComparer
CustomComparer<T>