SortedDictionary and SortedList, sorteddictionary
The above two interfaces are similar to dictionaries, and common methods of SortedList such as Find, FindIndex, and RemoveAll are not provided.
There is a big difference between the two data structures. SortedList finds extremely fast data, but it adds new elements, and the deletion speed is relatively low. SortedDictionary searches, adds, and deletes all elements on average.
Boyou test results:
Test it in Unity3D.
Public class Test: MonoBehaviour {void Start () {var sortedDict = new SortedDictionary <string, int> (); sortedDict. add ("a01", 10); sortedDict. add ("a10", 2); sortedDict. add ("a03", 5); sortedDict. add ("a02", 1); print (sortedDict ["a01"]); foreach (var item in sortedDict) {Debug. log ("SortedDictionary:" + item);} var sortedList = new SortedList <string, int> (); sortedList. add ("a01", 10); sortedList. add ("a10", 2); sortedList. add ("a03", 5); sortedList. add ("a02", 1); print (sortedList ["a01"]); foreach (var item in sortedList) {Debug. log ("SortedList:" + item) ;}} View Code
Call result: