orderby spec

CSharp · Console

/Program.cs

using System;
using System.Linq;					
public class Program
{
	public static void Main()
	{
		int index = 3;
		string[] list = new string[] {"zero","one","two","three","four","five","six"};
		 var result = list.Select((item ,i) => new { item , neworder = i == index ? 0 : 1})
           .OrderBy(x=> x.neworder).Select(a=> a.item);
		
		foreach(string x in result)
			Console.WriteLine(x);
	}
}
;