HOW TO FORCE ORDER BY LINQ

Jan 1 2015 7:33 PM

Hi Can any one please help

I like to do custom sort using linq ,

Below is the sample to do in SQL Server. I like to do using LINQ

USE [SqlAndMe]  GO   SELECT CountryName  FROM   dbo.Country  ORDER BY CASE WHEN CountryName = 'INDIA' THEN '1'                WHEN CountryName = 'CHINA' THEN '2'                ELSE CountryName END ASC  GO

CountryName

INDIA

CHINA

AUSTRALIA

BANGLADESH

FRANCE

JAPAN

NEW ZEALAND

PAKISTAN

SRI LANKA

UNITED KINGDOM UNITED STATES


Answers (3)