DevToys logo DevToys
  • Home
  • Blog
  • Documentation
  • Download
Search Results for

    Show / Hide Table of Contents

    Class DictionaryExtensions

    Provides extension methods for dictionaries.

    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: DevToys.Api
    Assembly: DevToys.Api.dll
    Syntax
    public static class DictionaryExtensions

    Methods

    GetValueOrDefault<TKey, TValue>(IDictionary<TKey, TValue>, TKey)

    Gets the value at the given key, or a default value.

    Declaration
    public static TValue? GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key)
    Parameters
    Type Name Description
    IDictionary<TKey, TValue> dictionary

    The dictionary to retrieve the value from.

    TKey key

    The key to retrieve the value for.

    Returns
    Type Description
    TValue

    The value associated with the specified key, or the default value if the key is not found.

    Type Parameters
    Name Description
    TKey

    The type of the keys in the dictionary.

    TValue

    The type of the values in the dictionary.

    In this article
    DevToys logo © 2024 DevToys