Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

NativeHashMap<T0,T1>

struct in Unity.Collections


Implements interfaces:INativeDisposable

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

An unordered, expandable associative array.

Not suitable for parallel write access. Use NativeParallelHashMap<T0,T1> instead.

Static Properties

Property Description
MaxCapacity The maximum number of elements this type of container can hold.

Properties

Property Description
Capacity The number of key-value pairs that fit in the current allocation.
Count The current number of key-value pairs in this hash map.
IsCreated Whether this hash map has been allocated (and not yet deallocated).
IsEmpty Whether this hash map is empty.
this[TKey] Gets and sets values by key.

Constructors

Constructor Description
NativeHashMap_2 Initializes and returns an instance of UnsafeHashMap.

Public Methods

Method Description
Add Adds a new key-value pair.
AsReadOnly Returns a readonly version of this NativeHashMap instance.
Clear Removes all key-value pairs.
ContainsKey Returns true if a given key is present in this hash map.
Dispose Releases all resources (memory).
GetEnumerator Returns an enumerator over the key-value pairs of this hash map.
GetKeyArray Returns an array with a copy of all this hash map's keys (in no particular order).
GetKeyValueArrays Returns a NativeKeyValueArrays with a copy of all this hash map's keys and values.
GetValueArray Returns an array with a copy of all this hash map's values (in no particular order).
Remove Removes a key-value pair.
TrimExcess Sets the capacity to match what it would be if it had been originally initialized with all its entries.
TryAdd Adds a new key-value pair.
TryGetValue Returns the value associated with a key.