C# Sorted List by Value with Object

前端 未结 9 926
失恋的感觉
失恋的感觉 2021-01-21 20:06

I\'m trying to create an \"ordered\" cache of objects in C#, where the order is determined by how many times that has been accessed.

I\'ve looked into Dictionary, Sorted

9条回答
  •  失恋的感觉
    2021-01-21 20:15

    What about this:

    var MyCache = new SortedDictionary();
    MyCache['My result 2'] = (MyCache['My result 2'] ?? 0) + 1;
    

提交回复
热议问题