Lines Matching defs:value
56 /// If a map is deserialized from a data stream and the value is missing from an entry, a default value
57 /// is created instead. For primitive types, that is the regular default value (0, the empty string and so
59 /// encoded value for the field.
62 /// This implementation does not generally prohibit the use of key/value types which are not
110 /// Adds the specified key/value pair to the map.
116 /// <param name="value">The value to add.</param>
118 public void Add(TKey key, TValue value)
125 this[key] = value;
139 private bool ContainsValue(TValue value) =>
140 list.Any(pair => ValueEqualityComparer.Equals(pair.Value, value));
164 /// Gets the value associated with the specified key.
166 /// <param name="key">The key whose value to get.</param>
167 /// <param name="value">When this method returns, the value associated with the specified key, if the key is found;
168 /// otherwise, the default value for the type of the <paramref name="value"/> parameter.
171 public bool TryGetValue(TKey key, out TValue value)
176 value = node.Value.Value;
181 value = default(TValue);
187 /// Gets or sets the value associated with the specified key.
189 /// <param name="key">The key of the value to get or set.</param>
191 /// <returns>The value associated with the specified key. If the specified key is not found,
198 TValue value;
199 if (TryGetValue(key, out value))
201 return value;
208 // value == null check here is redundant, but avoids boxing.
209 if (value == null)
211 ProtoPreconditions.CheckNotNullUnconstrained(value, nameof(value));
214 var pair = new KeyValuePair<TKey, TValue>(key, value);
291 /// Determines whether map contains an entry equivalent to the given key/value pair.
293 /// <param name="item">The key/value pair to find.</param>
297 TValue value;
298 return TryGetValue(item.Key, out value) && ValueEqualityComparer.Equals(item.Value, value);
302 /// Copies the key/value pairs in this map to an array.
312 /// Removes the specified key/value pair from the map.
314 /// <remarks>Both the key and the value must be found for the entry to be removed.</remarks>
315 /// <param name="item">The key/value pair to remove.</param>
316 /// <returns><c>true</c> if the key/value pair was found and removed; <c>false</c> otherwise.</returns>
343 /// Gets a value indicating whether the map is read-only.
381 /// The order of the key/value pairs in the maps is not deemed significant in this comparison.
402 TValue value;
403 if (!other.TryGetValue(pair.Key, out value))
407 if (!valueComparer.Equals(value, pair.Value))
424 /// <param name="codec">Codec describing how the key/value pairs are encoded</param>
447 /// <param name="codec">Codec describing how the key/value pairs are encoded</param>
533 void IDictionary.Add(object key, object value)
535 Add((TKey)key, (TValue)value);
588 TValue value;
589 TryGetValue((TKey)key, out value);
590 return value;
595 this[(TKey)key] = (TValue)value;
644 /// Creates a new entry codec based on a separate key codec and value codec,
648 /// <param name="valueCodec">The value codec.</param>
714 // Corner case: a map entry with a key but no value, where the value type is a message.