Creating a LINQ to Sample Extension Method
First of all we add Default.aspx in our application and write the following code in Default.aspx page:-

  

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <center> 
    <div>
       <h1>Creating a sample extension method:-</h1>
        <asp:ListBox ID="lbDetail" runat="server" Height="300px" Width="500px"></asp:ListBox> <br /> <br />
        <asp:Button ID="btnDisplayRecord" runat="server" Text="Display Record" Font-Bold="true" OnClick="btnDisplayRecord_Click" />
    
    </div>
            </center>
    </form>
</body>
</html>



Now, double click on Display Record and write the following code in our Default.aspx.cs:-

  

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnDisplayRecord_Click(object sender, EventArgs e)
    {
        lbDetail.Items.Clear();
        try
        {
            string[] data = { "apple ", "santosh ", "banana ", "pramod ", "pooja ", "gagan ", "example ", "mango ", "name ", "airport " };

            var query=data.OrderBy(santosh=>santosh);

            foreach (var result in query)
            {
                lbDetail.Items.Add(result);
            }
        }
        catch (Exception ex)
        {
            lbDetail.Items.Add(ex.Message);
        }
       
    }


}



Now run the applcation and click on Display Record button, output display as expected.