C# LINQ return counter array indices max to min -


a newbie c# , linq. have array counted sequence.

{1,3,5,2,7,2}

i trying write query returns list of indices highest values in descending order:

4,2,1,3,5,0

i can maximum index query below, can't seem work out how next indexes in sequence single query.

int index = array.tolist().indexof(array.max()); 

this works:

var list = new [] {1,3,5,2,7,2};  var indices =     list         .select((n, i) => new { n, })         .orderbydescending(x => x.n)         .select(x => x.i)         .toarray(); 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -