Show / Hide Table of Contents

    Class BetternessExtensions

    Extension methods related to the BetterResult enum.

    Inheritance
    System.Object
    BetternessExtensions
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Flame.Collections
    Assembly: Flame.dll
    Syntax
    public static class BetternessExtensions

    Methods

    | Improve this Doc View Source

    Flip(Betterness)

    "Flips" the given betterness: if the first element was better, then this method returns a betterness for the second element, and vice-versa.

    Declaration
    public static Betterness Flip(this Betterness Value)
    Parameters
    Type Name Description
    Betterness Value

    The beterness to flip.

    Returns
    Type Description
    Betterness
    | Improve this Doc View Source

    GetBestElementOrDefault<T>(IEnumerable<T>, Func<T, T, Betterness>)

    Tries the get best element in the sequence: the element that is better than every other element. If no such elemet is found, then the default value for its type is returned.

    Declaration
    public static T GetBestElementOrDefault<T>(this IEnumerable<T> Elements, Func<T, T, Betterness> Compare)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> Elements

    The sequence of elements to search through.

    System.Func<T, T, Betterness> Compare

    A function that compares to elements for betterness.

    Returns
    Type Description
    T

    The best element or the default value for its type.

    Type Parameters
    Name Description
    T

    The type of elements in the sequence.

    | Improve this Doc View Source

    TryGetBestElement<T>(IEnumerable<T>, Func<T, T, Betterness>, out T)

    Tries the get best element in the sequence: the element that is better than every other element.

    Declaration
    public static bool TryGetBestElement<T>(this IEnumerable<T> Elements, Func<T, T, Betterness> Compare, out T BestElement)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<T> Elements

    The sequence of elements to search through.

    System.Func<T, T, Betterness> Compare

    A function that compares to elements for betterness.

    T BestElement

    The best element in the sequence.

    Returns
    Type Description
    System.Boolean

    true, if a best element was found, false otherwise.

    Type Parameters
    Name Description
    T

    The type of elements in the sequence.

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX