docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class HashSetExtensions

    Extension methods for HashSet<T> objects.

    Inheritance
    object
    HashSetExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.XR.CoreUtils
    Assembly: Unity.XR.CoreUtils.dll
    Syntax
    public static class HashSetExtensions

    Methods

    ExceptWithNonAlloc<T>(HashSet<T>, HashSet<T>)

    Remove any elements in this set that are in the set specified by other.

    Declaration
    public static void ExceptWithNonAlloc<T>(this HashSet<T> self, HashSet<T> other)
    Parameters
    Type Name Description
    HashSet<T> self

    The set from which to remove elements.

    HashSet<T> other

    The set of elements to remove.

    Type Parameters
    Name Description
    T

    The type contained in the set.

    Remarks

    Equivalent to ExceptWith(IEnumerable<T>), but without any allocation.

    First<T>(HashSet<T>)

    Gets the first element of a HashSet.

    Declaration
    public static T First<T>(this HashSet<T> set)
    Parameters
    Type Name Description
    HashSet<T> set

    Set to retrieve the element from

    Returns
    Type Description
    T

    The first element in the set

    Type Parameters
    Name Description
    T

    Type contained in the set

    Remarks

    Equivalent to the System.Linq .First() method, but does not allocate.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)