### Use UnsafeDictionary Source: https://github.com/xenoatom/xenoatom.collections/blob/main/readme.md Creates an UnsafeDictionary and adds four key-value pairs, then iterates over the dictionary and prints each pair. UnsafeDictionary is a struct, but the underlying array is a managed array. ```csharp // UnsafeDictionary is a struct, but the underlying array is a managed array var dictionary = new UnsafeDictionary(); dictionary.Add(1, "One"); dictionary.Add(2, "Two"); dictionary.Add(3, "Three"); dictionary.Add(4, "Four"); foreach(var pair in dictionary) { Console.WriteLine($"{pair.Key} = {pair.Value}"); } ``` -------------------------------- ### Use UnsafeList.N4 with fixed-size stack array Source: https://github.com/xenoatom/xenoatom.collections/blob/main/readme.md Creates an UnsafeList.N4 and adds four elements, then iterates over the list using AsSpan() and prints each value. UnsafeList is a struct, and the underlying array is a fixed size array on the stack. ```csharp // UnsafeList is a struct, and the underlying array is a fixed size array (on the stack) var list = new UnsafeList.N4(); list.Add(1); list.Add(2); list.Add(3); list.Add(4); var span = list.AsSpan(); foreach(var value in span) { Console.WriteLine(value); } ``` -------------------------------- ### Use UnsafeHashSet Source: https://github.com/xenoatom/xenoatom.collections/blob/main/readme.md Creates an UnsafeHashSet and adds four elements, then iterates over the set and prints each value. UnsafeHashSet is a struct, but the underlying array is a managed array. ```csharp // UnsafeDictionary is a struct, but the underlying array is a managed array var hashSet = new UnsafeHashSet(); hashSet.Add(1); hashSet.Add(2); hashSet.Add(3); hashSet.Add(4); foreach(var value in hashSet) { Console.WriteLine(value); } ``` -------------------------------- ### Use UnsafeList with managed array Source: https://github.com/xenoatom/xenoatom.collections/blob/main/readme.md Creates an UnsafeList and adds four elements, then iterates over the list using AsSpan() and prints each value. UnsafeList is a struct, but the underlying array is a managed array. ```csharp // UnsafeList is a struct, but the underlying array is a managed array var list = new UnsafeList(); list.Add(1); list.Add(2); list.Add(3); list.Add(4); var span = list.AsSpan(); foreach(var value in span) { Console.WriteLine(value); } ```