/// <summary> /// Returns array populated with keys. /// </summary> /// <remarks>Number of returned keys will match number of values in the container. If key contains multiple values it will appear number of times /// how many values are associated to the same key. If only unique key values desired use GetUniqueKeyArray instead.</remarks> /// <param name="allocator">A member of the /// [Unity.Collections.Allocator](https://docs.unity3d.com/ScriptReference/Unity.Collections.Allocator.html) enumeration.</param> /// <returns>Array of keys.</returns> public NativeArray <TKey> GetKeyArray(Allocator allocator) { var result = new NativeArray <TKey>(Count(), allocator, NativeArrayOptions.UninitializedMemory); UnsafeHashMapData.GetKeyArray(m_Buffer, result); return(result); }
//--------------------------------------------------------------------------------------------------------- #region To Array public NativeArray <TKey> ToKeyArray(Allocator allocator) { var keys = new NativeArray <TKey>(Count(), allocator, NativeArrayOptions.UninitializedMemory); UnsafeHashMapData.GetKeyArray(mBuffer, keys); return(keys); }