Search Results for

    Show / Hide Table of Contents

    Class BetternessExtensions

    Extension methods related to the BetterResult enum.

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

    Methods

    | Edit this page 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
    | Edit this page 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
    IEnumerable<T> Elements

    The sequence of elements to search through.

    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.

    | Edit this page 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
    IEnumerable<T> Elements

    The sequence of elements to search through.

    Func<T, T, Betterness> Compare

    A function that compares to elements for betterness.

    T BestElement

    The best element in the sequence.

    Returns
    Type Description
    bool

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

    Type Parameters
    Name Description
    T

    The type of elements in the sequence.

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX