The NeoSmart.Collections
project includes a number of "missing" data structures, containers, and
collections not found (at least at the time of this publication) in the .NET Standard Library. All
collections are modelled after those in System.Collections
in the hope that .NET developers will
find them both familiar and useful.
You can read more about this library and the inspiration for it in the official release announcement.
This is a collection of data structures and collections designed to serve as performant alternatives
to the default System.Collections
containers under specific use cases. The author assumes that
you have arrived at this page because you are searching for a collection designed to perform both
correctly in the general case and efficiently only in the specific.
The collections included in the .NET Standard BCL are general purpose collections designed to operate with acceptable performance for the vast majority of .NET developers, under widely varying circumstances. With regards to performance, the primary focus is on the average case and reasonable efforts were made to avoid pathological behavior. This is not the case here. These data structures were written for specific use cases in which big-O ceases to have any meaning, and offer blazing performance only when used as intended. Assumptions are made allowing the design or curation of algorithms that would otherwise be suboptimal for the general case.
NeoSmart.Collections
is written by Mahmoud Al-Qudsi of NeoSmart Technologies, and is released to
the general public under the terms of the MIT open source license. It is currently being maintained
with updates and new collections added as they are needed by the author's other projects.
SortedList<T>
, a true sorted list implementation (directly indexed without a separate key) with better memory usage than the BCL'sSystem.Collections.SortedList<K,V>
and with significantly better performance thanSystem.Collections.SortedSet
(while still allowing duplicate data) when adding data in order.UniqueSortedList<T>
, a deduplicated version ofSortedList<T>
.ResizableArray<T>
, an object-oriented wrapper aroundT[]
that directly exposes various typically accessed viaArray.*
methods, to be used when you'd use aList<T>
but you need to also directly access the underlying array to interop with poorly designed APIs.DisposableList<T>
, a specializedList<T>
implementingIDispose
and callingT.Dispose()
on all its elements whenDisposableList<T>.Dispose()
is called.
NeoSmart.Collections
is available on
nuget.org and may be installed via the Visual
Studio Package Manager:
Install-Package NeoSmart.Collections
All types will be in the NeoSmart.Collections
namespace.
Release are also available on GitHub, and the bleeding edge version of the code may be obtained by cloning this repository.
Both bug fixes and improvements to existing code/docs/collections as well as implementations of new containers are welcome via Pull Requests. If you are adding a new container, please create an issue first to make sure this is the right place for it before expending the effort (although you probably needed it for something else anyway).
Improvements to the documentation and synchronizing the documentation between the web-visible documentation on GitHub and the in-editor XML Documentation are welcome!