src/AnvilPacker/Util/Collections/DictionarySlim.cs
/// <summary>
/// Gets the value if present for the specified key.
/// </summary>
/// <param name="key">Key to look for</param>
/// <param name="value">Value found, otherwise default(TValue)</param>
/// <returns>true if the key is present, otherwise false</returns>
Gets the value if present for the specified key.
Gets the value if present for the specified key .
public bool TryGetValue(TKey key, [NotNullWhen(true)] out TValue? value)
        {
            if (key == null) ThrowHelper.ThrowKeyArgumentNullException();
            Entry[] entries = _entries;
            int bucketIndex = key.GetHashCode() & (_buckets.Length - 1);
            for (int i = _buckets[bucketIndex] - 1; (uint)i < (uint)entries.Length; i = entries[i].next) {
                if (key.Equals(entries[i].key)) {
                    value = entries[i].value!;
                    return true;
                }
            }
            value = default;
            return false;
        }
public bool TryGetValue ( TKey key , [ NotNullWhen ( true ) ] out TValue ? value ) { if ( key == null ) ThrowHelper . ThrowKeyArgumentNullException ( ) ; Entry [ ] entries = _entries ; int bucketIndex = key . GetHashCode ( ) & ( _buckets . Length - 1 ) ; for ( int i = _buckets [ bucketIndex ] - 1 ; ( uint ) i < ( uint ) entries . Length ; i = entries [ i ] . next ) { if ( key . Equals ( entries [ i ] . key ) ) { value = entries [ i ] . value ! ; return true ; } } value = default ; return false ; }
Gets the value if present for the specified key.
Gets the value if present for the specified key .
true if the key is present, otherwise false
true if the key is present otherwise false
key
TKey
Key to look for
Key to look for
out
[NotNullWhen(true)]
value
Value found, otherwise default(TValue)
Value found otherwise default ( TValue )