কম্পিউটার টিউটোরিয়াল

C#-এ LINQ orderby ক্লজ

LINQ কোয়েরি সিনট্যাক্সে orderby ক্লজ ব্যবহার করে কালেকশন সর্ট করা যায়। ascending (ডিফল্ট) বা descending 지정 করা যায়।

উদাহরণ

using System;
using System.Collections.Generic;
using System.Linq;

class Demo {
    static void Main() {
        List list = new List { "iOS by Apple", "Android by Google", "Symbian by Nokia" };
        
        var sorted = from e in list orderby e.Length descending select e;
        foreach (string s in sorted) Console.WriteLine(s);
    }
}

আউটপুট

Android by Google
Symbian by Nokia
iOS by Apple
  1. C#-এ KeyValuePair ক্লাস

  2. C#-এ লিস্ট ক্লিয়ার করা (Clear)

  3. C#-এ Pair ক্লাস (KeyValuePair)

  4. SQL Server-এ ORDER BY ক্লজ