linq - How to count items of a sequence

Linq Count Operator - How to get the number of the items in a sequence as an int
LinqCountOperator.aspx

<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Linq" %>

<!DOCTYPE html>
<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] colors = {"Red","SkyBlue","SeaGreen","Orange","Salmon" };
        IEnumerable<string> filteredColors = from color in colors
                                             where color.StartsWith("S")
                                             select color ;

        Label1.Text = "Color List: <br />";

        foreach (string n in colors)
        {
            Label1.Text += n + "<br />";
        }

        Label2.Text = "Filtered Colors: StartsWith(S) <br />";

        foreach (string n in filteredColors)
        {
            Label2.Text += n + "<br />";
        }
        Label2.Text += "<br />Total Filtered Colors: " + filteredColors.Count() +"<br />";
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Linq Count Operator - How to get the number of the items in a sequence as an int</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:DarkBlue; font-style:italic;">
            Linq Standard Query Operator - Count
            <br />How to get the number of the items
            <br /> in a sequence as an int
        </h2>
        <hr width="375" align="left" color="CornFlowerBlue" />
        <asp:Label
             ID="Label1"
             runat="server"
             Font-Size="Large"
             ForeColor="OrangeRed"
             Font-Italic="true"
             >
        </asp:Label>
        <br />
        <asp:Label
             ID="Label2"
             runat="server"
             Font-Size="Large"
             ForeColor="DodgerBlue"
             Font-Italic="true"
             >
        </asp:Label>
        <br />
        <asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Count"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            />
    </div>
    </form>
</body>
</html>
More c# linq examples