Linq Reverse Operator - How to reverse the order of the items in a sequence
LinqReverseOperator.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[] fruits = { "Aprikose", "Coffee shrub of Arabia", "Bouea burmanica", "Kathal", "Jujube", "Lichi" };
IEnumerable<string> val = fruits.Reverse();
Label1.Text = "Fruits List: <br />";
foreach (string names in fruits)
{
Label1.Text += names.ToString() + "<br />";
}
Label2.Text = "After Calling The Reverse Operator<br />";
foreach (string n in val)
{
Label2.Text += n + "<br />";
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Linq Reverse Operator - How to reverse the order of the items in a sequence</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:DarkBlue; font-style:italic;">
Linq Standard Query Operator - Reverse
<br />How to reverse the order of the items in a sequence
</h2>
<hr width="500" align="left" color="CornFlowerBlue" />
<asp:Label
ID="Label1"
runat="server"
Font-Size="X-Large"
ForeColor="Maroon"
Font-Italic="true"
>
</asp:Label>
<br />
<asp:Label
ID="Label2"
runat="server"
Font-Size="X-Large"
ForeColor="SkyBlue"
Font-Italic="true"
>
</asp:Label>
<br />
<asp:Button
ID="Button1"
runat="server"
OnClick="Button1_Click"
Text="Test Linq Query Operator - Reverse"
Height="45"
Font-Bold="true"
ForeColor="DodgerBlue"
/>
</div>
</form>
</body>
</html>
- linq - How to sort elements of a sequence in ascending order
- How to use linq select query
- linq - How to get the sum of items in a numeric sequence
- linq - How to determine if any items in a sequence match condition
- linq - How to determine if a sequence contains a specific element
- linq - How to get a sequence without duplicate items
- linq - Get last element of a sequence that match condition or a default value
- linq - How to take a given number of elements from a sequence
- linq - Get single element of a sequence that match condition or a default value
- linq - How to cast elements of a sequence to a given data type