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

NativeHashSet<T0>

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 set of unique values.

Not suitable for parallel write access. Use NativeParallelHashSet<T0> instead.

Static Properties

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

Properties

Property Description
Capacity The number of values that fit in the current allocation.
Count Returns the current number of values in this set.
IsCreated Whether this set has been allocated (and not yet deallocated).
IsEmpty Whether this set is empty.

Constructors

Constructor Description
NativeHashSet_1 Initializes and returns an instance of NativeParallelHashSet.

Public Methods

Method Description
Add Adds a new value. If the value is already present in the collection, this method should throw, but currently does not! Instead, it returns false without replacing said item.
AsReadOnly Returns a readonly version of this NativeHashSet instance.
Clear Removes all values.
Contains Returns true if a particular value is present.
Dispose Releases all resources (memory and safety handles).
GetEnumerator Returns an enumerator over the values of this set.
Remove Removes a particular value.
ToNativeArray Returns an array with a copy of this set's values (in no particular order).
TrimExcess Sets the capacity to match what it would be if it had been originally initialized with all its entries.
TryAdd Attempts to add a new item. Only succeeds if the item was not present.