Mykhalik
Mykhalik

Reputation: 244

Get SortedList type after sorting in desc order

SortedList<string, object> testIds = new SortedList<string, object>();

Can I get SortedList type of collection after sort in descending order? For example :

SortedList<string, object> SortedTestIds = testIds.OrderByDescending(t=>t.Key);

or some other cases.

Upvotes: 0

Views: 70

Answers (1)

Dhaval Patel
Dhaval Patel

Reputation: 7601

you have to use the var like

var SortedTestIds = testIds.OrderByDescending(t => t.Key); 

or if you want SortedList then you have to use IComparer for your own Comparer.

here you can find it Click here

Upvotes: 1

Related Questions