public void CopyToTest() { var set = UnsafeDictionary.Allocate <int, decimal>(10); // Fill set for (int i = 0; i < 10; i++) { UnsafeDictionary.Add <int, decimal>(set, i, i * i * i); } var count = UnsafeDictionary.GetCount(set); var arr = new KeyValuePair <int, decimal> [count]; UnsafeDictionary.CopyTo(set, arr, 0); // Check int num = 0; for (int i = 0; i < count; i++) { Assert.AreEqual(i, arr[num].Key); Assert.AreEqual(i * i * i, arr[num++].Value); } UnsafeDictionary.Free(set); }