I am looking for a data structure in C# (.net framework) which I can use to add data in sorted order (instead of adding all data and then applying sort). My data are objects and I want to add them according to a certain field (integer field).
Thanks
option 1) use the SortedList and use your integer fields as key.
option 2) use SortedSet but be cautious .. this collection can only contain unique objects (no duplicates of the same object)
[System.Collections.Generic.SortedSet<T>][1]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With