文档

Unity Engine

Unity Engine

TryAdd(TKey, TValue)

Adds a new key-value pair.
阅读时间1 分钟最后更新于 1 个月前

Definition

  • Type: Method
  • Namespace: Unity.Collections
  • Assembly: UnityEngine.ManagedKernelModule

TryAdd(T, T)

public bool TryAdd(TKey key, TValue item)

Parameters

key

T
The key to add.

item

T
The value to add.

Returns

Type

Description

boolTrue if the key-value pair was added.

Remarks

If the key is already present, this method returns false without modifying the hash map.