docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class DictionaryExtensions

    Extension methods for Dictionary<TKey, TValue> objects.

    Inheritance
    object
    DictionaryExtensions
    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 DictionaryExtensions

    Methods

    First<TKey, TValue>(Dictionary<TKey, TValue>)

    Gets the first element in the dictionary.

    Declaration
    public static KeyValuePair<TKey, TValue> First<TKey, TValue>(this Dictionary<TKey, TValue> dictionary)
    Parameters
    Type Name Description
    Dictionary<TKey, TValue> dictionary

    Dictionary to retrieve the element from.

    Returns
    Type Description
    KeyValuePair<TKey, TValue>

    The first element in the dictionary.

    Type Parameters
    Name Description
    TKey

    Dictionary's Key type.

    TValue

    Dictionary's Value type.

    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)