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 -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -