<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6907853060498268911</id><updated>2012-02-02T11:00:39.469-08:00</updated><category term='Portal Frameworks Example'/><category term='Session Example'/><category term='Menu Example'/><category term='DetailsView Example'/><category term='BulletedList Example'/><category term='Asp.Net Basic Example'/><category term='asp.net DataPager example'/><category term='XmlDocument example'/><category term='PlaceHolder Example'/><category term='Themes and Skins Example'/><category term='FilterParameters Example'/><category term='Date Time Example'/><category term='asp.net ImageMap Example'/><category term='FileInfo class Example'/><category term='SiteMapPath Example'/><category term='Chart example and tutorial'/><category term='LinkButton Example'/><category term='Cross-Page PostBack Example'/><category term='User Control Example'/><category term='Linq Example'/><category term='Array Example'/><category term='TreeView Example'/><category term='Label Example'/><category term='asp.net Master Page Example'/><category term='Wizard Example'/><category term='SqlDataSource Example'/><category term='Membership Example'/><category term='asp.net ViewState Example'/><category term='RequiredFieldValidator Example'/><category term='CheckBoxList Example'/><category term='ado.net example'/><category term='Profile Example'/><category term='State Management Example'/><category term='SiteMapDataSource Example'/><category term='ListBox Example'/><category term='Button Example'/><category term='Cookie Example'/><category term='Image Example'/><category term='Roles Class Example'/><category term='System.Collections Example'/><category term='DropDownList Example'/><category term='RadioButton Example'/><category term='Path class Example'/><category term='XPath example'/><category term='asp.net ajax example'/><category term='Xml example'/><category term='Table Example'/><category term='QueryStringParameter Example'/><category term='SqlParameter Example'/><category term='HyperLink Example'/><category term='FileUpload Example'/><category term='RadioButtonList Example'/><category term='RangeValidator Example'/><category term='String Example'/><category term='asp.net Substitution Example'/><category term='XSLT example'/><category term='DataAdapter Example'/><category term='asp.net Caching Example'/><category term='TextBox Example'/><category term='Calendar Example'/><category term='Panel Example'/><category term='ObjectDataSource Example'/><category term='RegularExpressionValidator Example'/><category term='Validation Example'/><category term='ControlParameter Example'/><category term='Application State Example'/><category term='asp.net ListView example'/><category term='Web Service example'/><category term='asp.net FormView Example'/><category term='GridView Example'/><category term='asp.net MultiView Example'/><category term='File and Stream Example'/><category term='CheckBox Example'/><category term='DataReader Example'/><category term='XmlDataSource Example'/><title type='text'>asp.net example</title><subtitle type='html'>asp.net example</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://asp-net-example.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default?start-index=101&amp;max-results=100'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2132</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-5506963056739524155</id><published>2011-12-11T12:52:00.000-08:00</published><updated>2011-12-11T12:54:15.503-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Union Operator - How to get a sequence representing the union of two sequences</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Union Operator - How to get a sequence representing the union of two sequences
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqUnionOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        int[] nums1 = { 1, 2, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10 };
        int[] nums2 = { 1, 3, 3, 5, 7, 9, 11 };

        Label1.Text = "Number List 1:....... &amp;lt;br /&amp;gt;";
        foreach (int n in nums1)
        {
            Label1.Text += n.ToString() + ", ";
        }

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Number List 2:....... &amp;lt;br /&amp;gt;";
        foreach (int n in nums2)
        {
            Label1.Text += n.ToString() + ", ";
        }

        var val = nums1.Union(nums2);
        Label2.Text = "&amp;lt;br /&amp;gt;After Call Union Operator [nums1.Union(nums2)]:....... &amp;lt;br /&amp;gt;";
        foreach (int n in val)
        {
            Label2.Text += n.ToString() + ", ";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Union Operator - How to get a sequence representing the union of two sequences&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Set Operator - Union
            &amp;lt;br /&amp;gt;How to get a sequence representing the union of two sequences
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="625" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="SeaGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkMagenta"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Union"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-B4Y_M6TicSM/TuUYNoVDy-I/AAAAAAAAJ6o/HDDjGCeWgmM/s1600/LinqUnionOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 245px;" src="http://1.bp.blogspot.com/-B4Y_M6TicSM/TuUYNoVDy-I/AAAAAAAAJ6o/HDDjGCeWgmM/s400/LinqUnionOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684976727068232674" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-VQB5xM_yUow/TuUYWZS1H0I/AAAAAAAAJ60/vCv_kWt477E/s1600/LinqUnionOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 284px;" src="http://2.bp.blogspot.com/-VQB5xM_yUow/TuUYWZS1H0I/AAAAAAAAJ60/vCv_kWt477E/s400/LinqUnionOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684976877651173186" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-5506963056739524155?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5506963056739524155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5506963056739524155'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-union-operator-how-to-get-sequence.html' title='Linq Union Operator - How to get a sequence representing the union of two sequences'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-B4Y_M6TicSM/TuUYNoVDy-I/AAAAAAAAJ6o/HDDjGCeWgmM/s72-c/LinqUnionOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-7070114220641817702</id><published>2011-12-11T12:48:00.000-08:00</published><updated>2011-12-11T12:50:02.467-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq ToList Operator - How to get a List from a sequence</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq ToList Operator - How to get a List from a sequence
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqToListOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Kokosboom", "Korean mango", "Litchi chinensis", "Mafai", "Knoeper", "Mangostin" };
        
        Label1.Text = "Fruits List:....... &amp;lt;br /&amp;gt;";
        foreach (string item in fruits)
        {
            Label1.Text += item.ToString() + "&amp;lt;br /&amp;gt;";
        }

        List&amp;lt;string&amp;gt; query = (from f in fruits
                              where f.StartsWith("K")
                              orderby f
                              select f).ToList();

       Label2.Text = "Query Result Type: " + query.GetType() + "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;";
       
       Label2.Text += "Query Result:.... &amp;lt;br /&amp;gt;";
       for (int i = 0; i &amp;lt; query.Count; i++)
        {
            Label2.Text += query[i].ToString() + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq ToList Operator - How to get a List from a sequence&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Conversion Operator - ToList
            &amp;lt;br /&amp;gt;How to get a List from a sequence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="600" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="MidnightBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Crimson"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - ToList"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-IF4zEVvcnOA/TuUXMgaxPYI/AAAAAAAAJ6Q/CisIvCcR1AM/s1600/LinqToListOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 263px;" src="http://3.bp.blogspot.com/-IF4zEVvcnOA/TuUXMgaxPYI/AAAAAAAAJ6Q/CisIvCcR1AM/s400/LinqToListOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684975608253201794" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-nFowG9IpEpA/TuUXVNVXF7I/AAAAAAAAJ6c/t1IVm8GYscI/s1600/LinqToListOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 350px;" src="http://3.bp.blogspot.com/-nFowG9IpEpA/TuUXVNVXF7I/AAAAAAAAJ6c/t1IVm8GYscI/s400/LinqToListOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684975757749065650" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-7070114220641817702?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/7070114220641817702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/7070114220641817702'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-tolist-operator-how-to-get-list.html' title='Linq ToList Operator - How to get a List from a sequence'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-IF4zEVvcnOA/TuUXMgaxPYI/AAAAAAAAJ6Q/CisIvCcR1AM/s72-c/LinqToListOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-4100518079195294153</id><published>2011-12-11T12:44:00.000-08:00</published><updated>2011-12-11T12:45:58.457-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq ToArray Operator - How to get an Array from a sequence</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq ToArray Operator - How to get an Array from a sequence
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqToArrayOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Flor de Jamaica", "Fraise", "Fruit du dragon", "Grape", "Gulupa", "Kathon" };
        
        Label1.Text = "Fruits List:....... &amp;lt;br /&amp;gt;";
        foreach (string item in fruits)
        {
            Label1.Text += item.ToString() + "&amp;lt;br /&amp;gt;";
        }

       string[] query = (from f in fruits
                         where f.StartsWith("F")
                         orderby f
                         select f).ToArray();

        Label2.Text = "Query Result: Items Count - " + query.Length.ToString() + "&amp;lt;br /&amp;gt;";
        for (int i = 0; i &amp;lt; query.Length; i++)
        {
            Label2.Text += query[i].ToString() + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq ToArray Operator - How to get an Array from a sequence&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Conversion Operator - ToArray
            &amp;lt;br /&amp;gt;How to get an Array from a sequence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="600" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="MidnightBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkMagenta"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - ToArray"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-CSSxEYzGsfo/TuUWUaWxPXI/AAAAAAAAJ54/-CaKF3GEqAE/s1600/LinqToArrayOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 243px;" src="http://2.bp.blogspot.com/-CSSxEYzGsfo/TuUWUaWxPXI/AAAAAAAAJ54/-CaKF3GEqAE/s400/LinqToArrayOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684974644553137522" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-bZZ7bmVMqrM/TuUWagX7a3I/AAAAAAAAJ6E/MKBoiT4oA_Y/s1600/LinqToArrayOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 349px;" src="http://1.bp.blogspot.com/-bZZ7bmVMqrM/TuUWagX7a3I/AAAAAAAAJ6E/MKBoiT4oA_Y/s400/LinqToArrayOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684974749247826802" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-4100518079195294153?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4100518079195294153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4100518079195294153'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-toarray-operator-how-to-get-array.html' title='Linq ToArray Operator - How to get an Array from a sequence'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-CSSxEYzGsfo/TuUWUaWxPXI/AAAAAAAAJ54/-CaKF3GEqAE/s72-c/LinqToArrayOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-7307935636482259274</id><published>2011-12-11T12:40:00.000-08:00</published><updated>2011-12-11T12:42:10.376-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq OfType Operator - How to filter elements in a sequence of a given type</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq OfType Operator - How to filter elements in a sequence of a given type
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqOfTypeOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList items = new ArrayList();
        items.Add(1);
        items.Add("Crataeva marmelos");
        items.Add(2);
        items.Add("Durian Belanda");
        items.Add(3);
        items.Add("Figuier commun");
        
        Label1.Text = "ArrayList (items):....... &amp;lt;br /&amp;gt;";
        foreach (var item in items)
        {
            Label1.Text += item.ToString() + "&amp;lt;br /&amp;gt;";
        }

        IEnumerable&amp;lt;int&amp;gt; query = items.OfType&amp;lt;int&amp;gt;().Select(i =&amp;gt; i);

        Label2.Text = "Query Result After Call OfType Operator:....... &amp;lt;br /&amp;gt;";
        foreach (int item in query)
        {
            Label2.Text += item.ToString() + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq OfType Operator - How to filter elements in a sequence of a given type&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Conversion Operator - OfType
            &amp;lt;br /&amp;gt;How to filter elements in a sequence of a given type
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="600" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Purple"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - OfType"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-LqStU7yxW_U/TuUVaLe33oI/AAAAAAAAJ5g/oMDlxW5Pqc0/s1600/LinqOfTypeOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 242px;" src="http://3.bp.blogspot.com/-LqStU7yxW_U/TuUVaLe33oI/AAAAAAAAJ5g/oMDlxW5Pqc0/s400/LinqOfTypeOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684973644128181890" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-SI3ehRNuytU/TuUVh20MM0I/AAAAAAAAJ5s/qsm0_OBlNsQ/s1600/LinqOfTypeOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 342px;" src="http://3.bp.blogspot.com/-SI3ehRNuytU/TuUVh20MM0I/AAAAAAAAJ5s/qsm0_OBlNsQ/s400/LinqOfTypeOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684973776019403586" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-7307935636482259274?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/7307935636482259274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/7307935636482259274'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-oftype-operator-how-to-filter.html' title='Linq OfType Operator - How to filter elements in a sequence of a given type'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-LqStU7yxW_U/TuUVaLe33oI/AAAAAAAAJ5g/oMDlxW5Pqc0/s72-c/LinqOfTypeOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-2237031530483180983</id><published>2011-12-11T12:36:00.000-08:00</published><updated>2011-12-11T12:38:13.374-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Intersect Operator - How to get a sequence representing the intersection of two sequences</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Intersect Operator - How to get a sequence representing the intersection of two sequences
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqIntersectOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        int[] nums1 = { 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 9, 10 };
        int[] nums2 = { 1, 3, 3, 5, 7, 9, 9, 11 };

        Label1.Text = "Number List 1 (nums1):....... &amp;lt;br /&amp;gt;";
        foreach (int n in nums1)
        {
            Label1.Text += n.ToString() + ", ";
        }

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Number List 2 (nums2):....... &amp;lt;br /&amp;gt;";
        foreach (int n in nums2)
        {
            Label1.Text += n.ToString() + ", ";
        }

        var val = nums1.Intersect(nums2);
        Label2.Text = "&amp;lt;br /&amp;gt;After Call Intersect Operator [nums1.Intersect(nums2)]:....... &amp;lt;br /&amp;gt;";
        foreach (int n in val)
        {
            Label2.Text += n.ToString() + ", ";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Intersect Operator - How to get a sequence representing the intersection of two sequences&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Set Operator - Intersect
            &amp;lt;br /&amp;gt;How to get a sequence representing the intersection of two sequences
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="675" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="MediumOrchid"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Purple"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Intersect"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-Ch3QTIQi2mA/TuUUftrCEPI/AAAAAAAAJ5I/ojGnQ7o5ook/s1600/LinqIntersectOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 226px;" src="http://4.bp.blogspot.com/-Ch3QTIQi2mA/TuUUftrCEPI/AAAAAAAAJ5I/ojGnQ7o5ook/s400/LinqIntersectOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684972639693705458" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-bHO2pf-fRuo/TuUUmC0G_8I/AAAAAAAAJ5U/SBNUGwitMkc/s1600/LinqIntersectOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 260px;" src="http://2.bp.blogspot.com/-bHO2pf-fRuo/TuUUmC0G_8I/AAAAAAAAJ5U/SBNUGwitMkc/s400/LinqIntersectOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684972748448137154" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-2237031530483180983?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/2237031530483180983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/2237031530483180983'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-intersect-operator-how-to-get.html' title='Linq Intersect Operator - How to get a sequence representing the intersection of two sequences'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-Ch3QTIQi2mA/TuUUftrCEPI/AAAAAAAAJ5I/ojGnQ7o5ook/s72-c/LinqIntersectOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-4118002655599772578</id><published>2011-12-11T12:32:00.000-08:00</published><updated>2011-12-11T12:34:05.355-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Except Operator - How to get a sequence representing the difference between two sequences</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Except Operator - How to get a sequence representing the difference between two sequences
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqExceptOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        int[] nums1 = { 1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 9, 10 };
        int[] nums2 = { 1, 3, 3, 5, 7, 9, 9, 11, 13, 13 };

        Label1.Text = "Number List 1 (nums1):....... &amp;lt;br /&amp;gt;";
        foreach (int n in nums1)
        {
            Label1.Text += n.ToString() + ", ";
        }

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Number List 2 (nums2):....... &amp;lt;br /&amp;gt;";
        foreach (int n in nums2)
        {
            Label1.Text += n.ToString() + ", ";
        }

        var val = nums1.Except(nums2);
        Label2.Text = "&amp;lt;br /&amp;gt;After Call Except Operator [nums1.Except(nums2)]:....... &amp;lt;br /&amp;gt;";
        foreach (int n in val)
        {
            Label2.Text += n.ToString() + ", ";
        }

        var val2 = nums2.Except(nums1);
        Label2.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call Except Operator [nums2.Except(nums1)]:....... &amp;lt;br /&amp;gt;";
        foreach (int n in val2)
        {
            Label2.Text += n.ToString() + ", ";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Except Operator - How to get a sequence representing the difference between two sequences&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Set Operator - Except
            &amp;lt;br /&amp;gt;How to get a sequence representing the difference between two sequences
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="675" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="MediumSeaGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Purple"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Except"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-DFX9SeCvx4w/TuUThla8WrI/AAAAAAAAJ4w/6GdI-pSenqo/s1600/LinqExceptOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 214px;" src="http://2.bp.blogspot.com/-DFX9SeCvx4w/TuUThla8WrI/AAAAAAAAJ4w/6GdI-pSenqo/s400/LinqExceptOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684971572326849202" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-uD7BS6nkXTk/TuUToZf-ZOI/AAAAAAAAJ48/zttK_KQOaIs/s1600/LinqExceptOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 293px;" src="http://3.bp.blogspot.com/-uD7BS6nkXTk/TuUToZf-ZOI/AAAAAAAAJ48/zttK_KQOaIs/s400/LinqExceptOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684971689385813218" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-4118002655599772578?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4118002655599772578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4118002655599772578'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-except-operator-how-to-get.html' title='Linq Except Operator - How to get a sequence representing the difference between two sequences'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-DFX9SeCvx4w/TuUThla8WrI/AAAAAAAAJ4w/6GdI-pSenqo/s72-c/LinqExceptOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-1113517166034758687</id><published>2011-12-11T12:28:00.000-08:00</published><updated>2011-12-11T12:29:50.139-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Cast Operator - How to cast elements in a sequence to a given type</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Cast Operator - How to cast elements in a sequence to a given type
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqCastOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList fruits = new ArrayList();
        fruits.Add("Afrikanische Malve");
        fruits.Add("Aprikosenbaum");
        fruits.Add("Averrhoa carambola");
        fruits.Add("Cerasus avium");
        fruits.Add("Date palm");
        
        Label1.Text = "ArrayList (fruits):....... &amp;lt;br /&amp;gt;";
        foreach (string item in fruits)
        {
            Label1.Text += item.ToString() + "&amp;lt;br /&amp;gt;";
        }

        IEnumerable&amp;lt;string&amp;gt; query = fruits.Cast&amp;lt;string&amp;gt;().Select(f =&amp;gt; f);
        
        Label2.Text = "Query Result:....... &amp;lt;br /&amp;gt;";
        foreach (string item in query)
        {
            Label2.Text += item.ToString() + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Cast Operator - How to cast elements in a sequence to a given type&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Conversion Operator - Cast
            &amp;lt;br /&amp;gt;How to cast elements in a sequence to a given type
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="575" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="MediumSeaGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Purple"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Cast"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-hnhTMS59yHw/TuUShafsCiI/AAAAAAAAJ4Y/d6nybDMafr8/s1600/LinqCastOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 232px;" src="http://1.bp.blogspot.com/-hnhTMS59yHw/TuUShafsCiI/AAAAAAAAJ4Y/d6nybDMafr8/s400/LinqCastOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684970469882333730" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-MWyhbv5AzWc/TuUSobrPovI/AAAAAAAAJ4k/cRQ5K6qiz0c/s1600/LinqCastOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 380px;" src="http://4.bp.blogspot.com/-MWyhbv5AzWc/TuUSobrPovI/AAAAAAAAJ4k/cRQ5K6qiz0c/s400/LinqCastOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684970590458323698" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-1113517166034758687?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1113517166034758687'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1113517166034758687'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-cast-operator-how-to-cast-elements.html' title='Linq Cast Operator - How to cast elements in a sequence to a given type'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-hnhTMS59yHw/TuUShafsCiI/AAAAAAAAJ4Y/d6nybDMafr8/s72-c/LinqCastOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8816619138703032593</id><published>2011-12-10T08:20:00.000-08:00</published><updated>2011-12-10T08:22:00.570-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>How to use Linq SingleOrDefault operator with condition</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to use Linq SingleOrDefault operator with condition
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqSingleOrDefaultOperatorWithCondition.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Zoete sinaasappel", "Pyrus communis", "Sandoricum indicum", "Strawberry pear" };

        var val = from f in fruits
                                 select f;

        Label1.Text = "Fruits List:....... &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling SingleOrDefault Operator With Condition [EndsWith('communis')]: " + val.SingleOrDefault(f =&amp;gt; f.EndsWith("communis"));
        Label2.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Calling SingleOrDefault Operator With Condition [EndsWith('false')]: " + val.SingleOrDefault(f =&amp;gt; f.EndsWith("false"));
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to use Linq SingleOrDefault operator with condition&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Element Operator - SingleOrDefault With Condition
            &amp;lt;br /&amp;gt;How to get the single element of a sequence or a
            &amp;lt;br /&amp;gt; default value if no element is found
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="725" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="IndianRed"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="CornflowerBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - SingleOrDefault"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-MhuD_dF0GTo/TuOG7DI-3LI/AAAAAAAAJ4A/4g4W7m_Q3n0/s1600/LinqSingleOrDefaultOperatorWithCondition.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 231px;" src="http://4.bp.blogspot.com/-MhuD_dF0GTo/TuOG7DI-3LI/AAAAAAAAJ4A/4g4W7m_Q3n0/s400/LinqSingleOrDefaultOperatorWithCondition.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684535503685082290" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-Mwq2i2wqReI/TuOHC8rBXWI/AAAAAAAAJ4M/EUD8NSdPjIo/s1600/LinqSingleOrDefaultOperatorWithCondition1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 212px;" src="http://2.bp.blogspot.com/-Mwq2i2wqReI/TuOHC8rBXWI/AAAAAAAAJ4M/EUD8NSdPjIo/s400/LinqSingleOrDefaultOperatorWithCondition1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684535639387757922" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8816619138703032593?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8816619138703032593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8816619138703032593'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/how-to-use-linq-singleordefault.html' title='How to use Linq SingleOrDefault operator with condition'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-MhuD_dF0GTo/TuOG7DI-3LI/AAAAAAAAJ4A/4g4W7m_Q3n0/s72-c/LinqSingleOrDefaultOperatorWithCondition.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8178418859685691523</id><published>2011-12-10T08:16:00.000-08:00</published><updated>2011-12-10T08:17:55.897-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq SingleOrDefault Operator - How to get the single element of a sequence or a default value if no element is found</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq SingleOrDefault Operator - How to get the single element of a sequence or a default value if no element is found
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqSingleOrDefaultOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Manilkara zapota", "Litchi chevelu", "Orange Frucht", "Pitahaya roja" };

        var itemEndsWithFrucht = from f in fruits
                                 where f.EndsWith("Frucht")
                                 select f;

        var itemEndsWithFalse = from f in fruits
                                where f.EndsWith("False")
                                 select f;

        Label1.Text = "Fruits List:....... &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling SingleOrDefault Operator [itemEndsWithFrucht]: " + itemEndsWithFrucht.SingleOrDefault();
        Label2.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Calling SingleOrDefault Operator [itemEndsWithFalse]: " + itemEndsWithFalse.SingleOrDefault();
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq SingleOrDefault Operator - How to get the single element of a sequence or a default value if no element is found&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Element Operator - SingleOrDefault
            &amp;lt;br /&amp;gt;How to get the single element of a sequence or a
            &amp;lt;br /&amp;gt; default value if no element is found
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="525" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkOrchid"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="CornflowerBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - SingleOrDefault"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-xWYoweEsPQY/TuOF9W_wOgI/AAAAAAAAJ3o/DBApH32PIlo/s1600/LinqSingleOrDefaultOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 247px;" src="http://3.bp.blogspot.com/-xWYoweEsPQY/TuOF9W_wOgI/AAAAAAAAJ3o/DBApH32PIlo/s400/LinqSingleOrDefaultOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684534443863194114" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-Yc8nZo4lZ7Q/TuOGFas6CvI/AAAAAAAAJ30/duNwtC-ZifI/s1600/LinqSingleOrDefaultOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 256px;" src="http://1.bp.blogspot.com/-Yc8nZo4lZ7Q/TuOGFas6CvI/AAAAAAAAJ30/duNwtC-ZifI/s400/LinqSingleOrDefaultOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684534582296840946" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8178418859685691523?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8178418859685691523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8178418859685691523'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-singleordefault-operator-how-to.html' title='Linq SingleOrDefault Operator - How to get the single element of a sequence or a default value if no element is found'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-xWYoweEsPQY/TuOF9W_wOgI/AAAAAAAAJ3o/DBApH32PIlo/s72-c/LinqSingleOrDefaultOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-3871098502522655856</id><published>2011-12-10T08:12:00.000-08:00</published><updated>2011-12-10T08:13:53.992-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>How to use Linq Single operator with condition</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to use Linq Single operator with condition
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqSingleOperatorWithCondition.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Dragon eye", "Fico comune", "Gewone peer", "Guayaba manzana", "Kiwi fruit" };

        var val = from f in fruits
                  select f;

        Label1.Text = "Fruits List:....... &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling Single Operator With Condition [StartsWith('Gewone')]: &amp;lt;br /&amp;gt;";
        Label2.Text += val.Single(f =&amp;gt; f.StartsWith("Gewone"));
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to use Linq Single operator with condition&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Element Operator - Single With Condition
            &amp;lt;br /&amp;gt;How to get the single element of a sequence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="650" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="OrangeRed"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="SkyBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Single"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-6wcfLlT34Uo/TuOFBktXMkI/AAAAAAAAJ3Q/H9CgS3BwpMg/s1600/LinqSingleOperatorWithCondition.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 230px;" src="http://3.bp.blogspot.com/-6wcfLlT34Uo/TuOFBktXMkI/AAAAAAAAJ3Q/H9CgS3BwpMg/s400/LinqSingleOperatorWithCondition.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684533416752001602" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-EljDZISnwtw/TuOFI4ZTp0I/AAAAAAAAJ3c/TyNgk_4wQ_E/s1600/LinqSingleOperatorWithCondition1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 257px;" src="http://4.bp.blogspot.com/-EljDZISnwtw/TuOFI4ZTp0I/AAAAAAAAJ3c/TyNgk_4wQ_E/s400/LinqSingleOperatorWithCondition1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684533542295676738" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-3871098502522655856?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3871098502522655856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3871098502522655856'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/how-to-use-linq-single-operator-with.html' title='How to use Linq Single operator with condition'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-6wcfLlT34Uo/TuOFBktXMkI/AAAAAAAAJ3Q/H9CgS3BwpMg/s72-c/LinqSingleOperatorWithCondition.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8203211186673384686</id><published>2011-12-10T08:08:00.001-08:00</published><updated>2011-12-10T08:09:40.412-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Single Operator - How to get the single element of a sequence</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Single Operator - How to get the single element of a sequence
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqSingleOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Cambodian palm", "Burmese Grape", "Citrus maxima", "Custard apple" };

        var itemEndsWithGrape = from f in fruits
                                           where f.EndsWith("Grape")
                                           select f;

        Label1.Text = "Fruits List:....... &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling Single Operator: " + itemEndsWithGrape.Single();
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Single Operator - How to get the single element of a sequence&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Element Operator - Single
            &amp;lt;br /&amp;gt;How to get the single element of a sequence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="600" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkOrchid"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="SkyBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Single"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-SKACbLXIzSk/TuOECsvBFBI/AAAAAAAAJ24/8g1wKTl5H8w/s1600/LinqSingleOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 251px;" src="http://1.bp.blogspot.com/-SKACbLXIzSk/TuOECsvBFBI/AAAAAAAAJ24/8g1wKTl5H8w/s400/LinqSingleOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684532336574665746" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-aZqX-SVdmvs/TuOEJq-f6bI/AAAAAAAAJ3E/F5r-3X_tJoE/s1600/LinqSingleOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 275px;" src="http://3.bp.blogspot.com/-aZqX-SVdmvs/TuOEJq-f6bI/AAAAAAAAJ3E/F5r-3X_tJoE/s400/LinqSingleOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684532456361814450" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8203211186673384686?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8203211186673384686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8203211186673384686'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-single-operator-how-to-get-single.html' title='Linq Single Operator - How to get the single element of a sequence'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-SKACbLXIzSk/TuOECsvBFBI/AAAAAAAAJ24/8g1wKTl5H8w/s72-c/LinqSingleOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-1198805389852642795</id><published>2011-12-10T08:04:00.001-08:00</published><updated>2011-12-10T08:05:43.515-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq SequenceEqual Operator - How to compare two sequences to see if they are equivalent</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq SequenceEqual Operator - How to compare two sequences to see if they are equivalent
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqSequenceEqualOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruitsList1 = { "Citrus sinensis", "Diospyros blancoi", "Coconut palm" };
        string[] fruitsList2 = { "Jambosa jambos", "Korean mango", "Malabar plum" };
        string[] fruitsList3 = { "Citrus sinensis", "Diospyros blancoi", "Coconut palm" };

        Label1.Text = "Fruits List 1:....... &amp;lt;br /&amp;gt;";
        foreach (string names in fruitsList1)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label1.Text += "&amp;lt;br /&amp;gt;Fruits List 2:....... &amp;lt;br /&amp;gt;";
        foreach (string names in fruitsList2)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label1.Text += "&amp;lt;br /&amp;gt;Fruits List 3:....... &amp;lt;br /&amp;gt;";
        foreach (string names in fruitsList3)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling SequenceEqual Operator [fruitsList1.Equals(fruitsList2)]: " + fruitsList1.SequenceEqual(fruitsList2);
        Label2.Text += "&amp;lt;br /&amp;gt;After Calling SequenceEqual Operator [fruitsList1.Equals(fruitsList3)]: " + fruitsList1.SequenceEqual(fruitsList3);
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq SequenceEqual Operator - How to compare two sequences to see if they are equivalent&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator - SequenceEqual
            &amp;lt;br /&amp;gt;How to compare two sequences to see if they are equivalent
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="575" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="SeaGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkMagenta"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - SequenceEqual"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-ZNqog-YynrM/TuODFpXldAI/AAAAAAAAJ2g/wL36Y4FnhJM/s1600/LinqSequenceEqualOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 246px;" src="http://1.bp.blogspot.com/-ZNqog-YynrM/TuODFpXldAI/AAAAAAAAJ2g/wL36Y4FnhJM/s400/LinqSequenceEqualOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684531287699059714" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-ZEZRF1sxfS4/TuODOJDMJlI/AAAAAAAAJ2s/DIdGpcOeZYM/s1600/LinqSequenceEqualOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 349px;" src="http://2.bp.blogspot.com/-ZEZRF1sxfS4/TuODOJDMJlI/AAAAAAAAJ2s/DIdGpcOeZYM/s400/LinqSequenceEqualOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684531433642403410" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-1198805389852642795?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1198805389852642795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1198805389852642795'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-sequenceequal-operator-how-to.html' title='Linq SequenceEqual Operator - How to compare two sequences to see if they are equivalent'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-ZNqog-YynrM/TuODFpXldAI/AAAAAAAAJ2g/wL36Y4FnhJM/s72-c/LinqSequenceEqualOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-3097389431387808985</id><published>2011-12-10T07:59:00.000-08:00</published><updated>2011-12-10T08:01:27.888-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Repeat Operator - How to generate a sequence by repeating an item a given number of times</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Repeat Operator - How to generate a sequence by repeating an item a given number of times
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqRepeatOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        var repeatedText = Enumerable.Repeat("asp.net example",5);

        Label1.Text = "Repeated Item....... &amp;lt;br /&amp;gt;";
        foreach (string s in repeatedText)
        {
            Label1.Text += s.ToString() + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Repeat Operator - How to generate a sequence by repeating an item a given number of times&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator
            &amp;lt;br /&amp;gt; Generation Operator - Repeat
            &amp;lt;br /&amp;gt;How to generate a sequence by
            &amp;lt;br /&amp;gt; repeating an item a given number of times
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="425" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkOrchid"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Repeat"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-TCjnCbYgdAo/TuOCAcwXjLI/AAAAAAAAJ2I/uqY7Zc4PbOk/s1600/LinqRepeatOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 260px;" src="http://2.bp.blogspot.com/-TCjnCbYgdAo/TuOCAcwXjLI/AAAAAAAAJ2I/uqY7Zc4PbOk/s400/LinqRepeatOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684530098902371506" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-ZH3RCs8e-hY/TuOCH_QllmI/AAAAAAAAJ2U/y4I8VBCMWVw/s1600/LinqRepeatOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 378px;" src="http://2.bp.blogspot.com/-ZH3RCs8e-hY/TuOCH_QllmI/AAAAAAAAJ2U/y4I8VBCMWVw/s400/LinqRepeatOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684530228423399010" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-3097389431387808985?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3097389431387808985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3097389431387808985'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-repeat-operator-how-to-generate.html' title='Linq Repeat Operator - How to generate a sequence by repeating an item a given number of times'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-TCjnCbYgdAo/TuOCAcwXjLI/AAAAAAAAJ2I/uqY7Zc4PbOk/s72-c/LinqRepeatOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-5286228762543574128</id><published>2011-12-10T07:55:00.001-08:00</published><updated>2011-12-10T07:56:45.076-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Range Operator - How to generate a sequence of numbers given a range</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Range Operator - How to generate a sequence of numbers given a range
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqRangeOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        var nums = Enumerable.Range(100,10);

        Label1.Text = "Sequence of numbers....... &amp;lt;br /&amp;gt;";
        foreach (int number in nums)
        {
            Label1.Text += number.ToString() + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Range Operator - How to generate a sequence of numbers given a range&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Generation Operator - Range
            &amp;lt;br /&amp;gt;How to generate a sequence of numbers given a range
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="550" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="SeaGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Range"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-jngLdVu-09w/TuOA-rjsIdI/AAAAAAAAJ1w/h5OFP8r95aA/s1600/LinqRangeOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 242px;" src="http://4.bp.blogspot.com/-jngLdVu-09w/TuOA-rjsIdI/AAAAAAAAJ1w/h5OFP8r95aA/s400/LinqRangeOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684528969004360146" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-pgMrMzuEcDE/TuOBG5xg6DI/AAAAAAAAJ18/l9GmO66sS8Q/s1600/LinqRangeOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 344px;" src="http://1.bp.blogspot.com/-pgMrMzuEcDE/TuOBG5xg6DI/AAAAAAAAJ18/l9GmO66sS8Q/s400/LinqRangeOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684529110259394610" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-5286228762543574128?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5286228762543574128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5286228762543574128'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-range-operator-how-to-generate.html' title='Linq Range Operator - How to generate a sequence of numbers given a range'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-jngLdVu-09w/TuOA-rjsIdI/AAAAAAAAJ1w/h5OFP8r95aA/s72-c/LinqRangeOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-6372442709246595217</id><published>2011-12-10T07:51:00.001-08:00</published><updated>2011-12-10T07:52:30.227-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq ElementAtOrDefault Operator - How to get the element at a given index in a sequence or a default value if the index is out of range</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq ElementAtOrDefault Operator - How to get the element at a given index in a sequence or a default value if the index is out of range
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqElementAtOrDefaultOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Anón", "Annona reticulata", "Atte", "Bramble fruit" };

        string elementAtOrDefaultIndex1 = (from f in fruits
                                           select f).ElementAtOrDefault(1);

        string elementAtOrDefaultIndex5 = (from f in fruits
                                           select f).ElementAtOrDefault(5);

        Label1.Text = "Fruits List:....... &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling ElementAtOrDefault(1) Operator: " + elementAtOrDefaultIndex1;
        Label2.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Calling ElementAtOrDefault(5) Operator: " + elementAtOrDefaultIndex5;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq ElementAtOrDefault Operator - How to get the element at a given index in a sequence or a default value if the index is out of range&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Element Operator - ElementAtOrDefault
            &amp;lt;br /&amp;gt;How to get the element at a given index in a sequence or
            &amp;lt;br /&amp;gt; a default value if the index is out of range
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="600" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkOrchid"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="MediumBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - ElementAtOrDefault"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-3yTmDROVg0c/TuOAA4_yDGI/AAAAAAAAJ1Y/0dyKHIzJ7ek/s1600/LinqElementAtOrDefaultOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 231px;" src="http://3.bp.blogspot.com/-3yTmDROVg0c/TuOAA4_yDGI/AAAAAAAAJ1Y/0dyKHIzJ7ek/s400/LinqElementAtOrDefaultOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684527907459959906" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-Q4n4VhWIfD0/TuOAIJKFJOI/AAAAAAAAJ1k/9w-PxTcvUMQ/s1600/LinqElementAtOrDefaultOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 275px;" src="http://3.bp.blogspot.com/-Q4n4VhWIfD0/TuOAIJKFJOI/AAAAAAAAJ1k/9w-PxTcvUMQ/s400/LinqElementAtOrDefaultOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684528032057205986" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-6372442709246595217?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/6372442709246595217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/6372442709246595217'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-elementatordefault-operator-how-to.html' title='Linq ElementAtOrDefault Operator - How to get the element at a given index in a sequence or a default value if the index is out of range'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-3yTmDROVg0c/TuOAA4_yDGI/AAAAAAAAJ1Y/0dyKHIzJ7ek/s72-c/LinqElementAtOrDefaultOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-6606460100571201925</id><published>2011-12-10T07:46:00.000-08:00</published><updated>2011-12-10T07:47:55.114-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq DefaultIfEmpty Operator - How to create a default element for an empty sequence</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq DefaultIfEmpty Operator - How to create a default element for an empty sequence
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqDefaultIfEmptyOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Lusho fruit", "Cambodian palm", "Chinesische Haselnuss", "Jambosa jambos", "Chinesische Jujube" };

        var itemStartWithC = from f in fruits
                             where f.StartsWith("C")
                             select f;
        var itemStartWithX = from f in fruits
                             where f.StartsWith("X")
                             select f;

        Label1.Text = "Fruits List:....... &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "Fruits Start With(C):....... &amp;lt;br /&amp;gt;";
        foreach (string names in itemStartWithC.DefaultIfEmpty("Default Value"))
        {
            Label2.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text += "&amp;lt;br /&amp;gt;Fruits Start With(X):....... &amp;lt;br /&amp;gt;";
        foreach (string names in itemStartWithX.DefaultIfEmpty("Default Value"))
        {
            Label2.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq DefaultIfEmpty Operator - How to create a default element for an empty sequence&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Element Operator - DefaultIfEmpty
            &amp;lt;br /&amp;gt;How to create a default element for an empty sequence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="600" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="SeaGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkMagenta"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - DefaultIfEmpty"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-oKxcfFJ777w/TuN-58R-n9I/AAAAAAAAJ1A/kYMWy1_85ng/s1600/LinqDefaultIfEmptyOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 238px;" src="http://3.bp.blogspot.com/-oKxcfFJ777w/TuN-58R-n9I/AAAAAAAAJ1A/kYMWy1_85ng/s400/LinqDefaultIfEmptyOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684526688570875858" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-8_eL7x8px4Q/TuN_By6b53I/AAAAAAAAJ1M/qRMyWeeypX4/s1600/LinqDefaultIfEmptyOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 359px;" src="http://4.bp.blogspot.com/-8_eL7x8px4Q/TuN_By6b53I/AAAAAAAAJ1M/qRMyWeeypX4/s400/LinqDefaultIfEmptyOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684526823495165810" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-6606460100571201925?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/6606460100571201925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/6606460100571201925'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-defaultifempty-operator-how-to.html' title='Linq DefaultIfEmpty Operator - How to create a default element for an empty sequence'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-oKxcfFJ777w/TuN-58R-n9I/AAAAAAAAJ1A/kYMWy1_85ng/s72-c/LinqDefaultIfEmptyOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-1059857862478747781</id><published>2011-12-10T07:41:00.000-08:00</published><updated>2011-12-10T07:42:50.190-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Concat Operator - How to concatenate two sequences into one sequence</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Concat Operator - How to concatenate two sequences into one sequence
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqConcatOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruitsStartsWithA = { "Actinidia deliciosa", "Albero del pane", "Annona muricata" };
        string[] fruitsStartsWithB = { "Brazilian pawpaw", "Bramble fruit" };

        var allFruits = fruitsStartsWithA.Concat(fruitsStartsWithB);

        Label1.Text = "Fruits Starts With 'A' List:....... &amp;lt;br /&amp;gt;";
        foreach (string names in fruitsStartsWithA)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label1.Text += "&amp;lt;br /&amp;gt;Fruits Starts With 'B' List:....... &amp;lt;br /&amp;gt;";
        foreach (string names in fruitsStartsWithB)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "All Fruits After Calling Concat Operator:....... &amp;lt;br /&amp;gt;";
        foreach (string names in allFruits)
        {
            Label2.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Concat Operator - How to concatenate two sequences into one sequence&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator - Concat
            &amp;lt;br /&amp;gt;How to concatenate two sequences into one sequence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="525" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="SeaGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkMagenta"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Concat"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-Spw7lojqixk/TuN9wcjxizI/AAAAAAAAJ0o/rof0n0cgz-E/s1600/LinqConcatOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 272px;" src="http://4.bp.blogspot.com/-Spw7lojqixk/TuN9wcjxizI/AAAAAAAAJ0o/rof0n0cgz-E/s400/LinqConcatOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684525425925131058" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-FUq2nwmnnJs/TuN92zOnGTI/AAAAAAAAJ00/WfXsGVcNQCA/s1600/LinqConcatOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 377px; height: 400px;" src="http://4.bp.blogspot.com/-FUq2nwmnnJs/TuN92zOnGTI/AAAAAAAAJ00/WfXsGVcNQCA/s400/LinqConcatOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684525535089596722" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-1059857862478747781?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1059857862478747781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1059857862478747781'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-concat-operator-how-to-concatenate.html' title='Linq Concat Operator - How to concatenate two sequences into one sequence'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-Spw7lojqixk/TuN9wcjxizI/AAAAAAAAJ0o/rof0n0cgz-E/s72-c/LinqConcatOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-512130257020443076</id><published>2011-12-09T08:40:00.001-08:00</published><updated>2011-12-09T08:41:32.448-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq TakeWhile Operator - How to get a sequence that takes items that meet an expression</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq TakeWhile Operator - How to get a sequence that takes items that meet an expression
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqTakeWhileOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        int[] nums = { 129,56,21,9,421,169,26,89 };

        IEnumerable&amp;lt;int&amp;gt; val = nums.OrderBy(n =&amp;gt; n).TakeWhile(n=&amp;gt; n&amp;lt;50);

        Label1.Text = "Numbers List: &amp;lt;br /&amp;gt;";

        foreach (int i in nums)
        {
            Label1.Text += i.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling TakeWhile(number&amp;lt;50) Operator:&amp;lt;br /&amp;gt;";
        foreach (int n in val)
        {
            Label2.Text += n.ToString() + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq TakeWhile Operator - How to get a sequence that takes items that meet an expression&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Partitioning Operator - TakeWhile
            &amp;lt;br /&amp;gt;How to get a sequence that takes items that meet an expression
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="650" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="OrangeRed"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="SaddleBrown"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - TakeWhile"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-ySm08McB2Rs/TuI6BzsjgDI/AAAAAAAAJ0Q/7zD5gF-b4yM/s1600/LinqTakeWhileOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 235px;" src="http://3.bp.blogspot.com/-ySm08McB2Rs/TuI6BzsjgDI/AAAAAAAAJ0Q/7zD5gF-b4yM/s400/LinqTakeWhileOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684169482426351666" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-ACJAu9pPZX4/TuI6I3cTmuI/AAAAAAAAJ0c/N10x6ipzE_g/s1600/LinqTakeWhileOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 361px;" src="http://3.bp.blogspot.com/-ACJAu9pPZX4/TuI6I3cTmuI/AAAAAAAAJ0c/N10x6ipzE_g/s400/LinqTakeWhileOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684169603691027170" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-512130257020443076?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/512130257020443076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/512130257020443076'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-takewhile-operator-how-to-get.html' title='Linq TakeWhile Operator - How to get a sequence that takes items that meet an expression'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-ySm08McB2Rs/TuI6BzsjgDI/AAAAAAAAJ0Q/7zD5gF-b4yM/s72-c/LinqTakeWhileOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-7814523853719582437</id><published>2011-12-09T08:35:00.000-08:00</published><updated>2011-12-09T08:36:47.302-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Take Operator - How to get a sequence that takes a given number of items</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Take Operator - How to get a sequence that takes a given number of items
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqTakeOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        int[] nums = { 255,21,455,41,233,169,26,123 };

        IEnumerable&amp;lt;int&amp;gt; val = nums.OrderByDescending(n =&amp;gt; n).Take(3);

        Label1.Text = "Numbers List: &amp;lt;br /&amp;gt;";

        foreach (int i in nums)
        {
            Label1.Text += i.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling Take(3) Operator: Top 3 numbers&amp;lt;br /&amp;gt;";
        foreach (int n in val)
        {
            Label2.Text += n.ToString() + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Take Operator - How to get a sequence that takes a given number of items&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Partitioning Operator - Take
            &amp;lt;br /&amp;gt;How to get a sequence that takes a given number of items
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="600" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkMagenta"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkCyan"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Take"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/--ZOowyoJjRY/TuI45Q_Fs1I/AAAAAAAAJz4/OF_6Sla_TQg/s1600/LinqTakeOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 233px;" src="http://3.bp.blogspot.com/--ZOowyoJjRY/TuI45Q_Fs1I/AAAAAAAAJz4/OF_6Sla_TQg/s400/LinqTakeOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684168236158268242" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-e_snX8JRikE/TuI5AcCUxUI/AAAAAAAAJ0E/IpgqBV3fzWk/s1600/LinqTakeOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 391px;" src="http://2.bp.blogspot.com/-e_snX8JRikE/TuI5AcCUxUI/AAAAAAAAJ0E/IpgqBV3fzWk/s400/LinqTakeOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684168359383713090" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-7814523853719582437?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/7814523853719582437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/7814523853719582437'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-take-operator-how-to-get-sequence.html' title='Linq Take Operator - How to get a sequence that takes a given number of items'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/--ZOowyoJjRY/TuI45Q_Fs1I/AAAAAAAAJz4/OF_6Sla_TQg/s72-c/LinqTakeOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8438901116530639810</id><published>2011-12-09T08:31:00.001-08:00</published><updated>2011-12-09T08:32:43.462-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>How to use Linq LastOrDefault operator with condition</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to use Linq LastOrDefault operator with condition
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqLastOrDefaultOperatorWithCondition.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Shaddock", "Starfruit", "Zibetbaum", "Tasajo", "Zoete kers", "Water apple" };

        string lastOrDefaultFruitsItemStartsWithZ = (from f in fruits
                                                     select f).LastOrDefault(f =&amp;gt; f.StartsWith("Z"));

        string lastOrDefaultFruitsItemStartsWithX = (from f in fruits
                                                     select f).LastOrDefault(f =&amp;gt; f.StartsWith("X"));

        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling LastOrDefault Operator With Condition [StartsWith('Z')]: " + lastOrDefaultFruitsItemStartsWithZ;
        Label2.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Calling LastOrDefault Operator With Condition [StartsWith('X')]: " + lastOrDefaultFruitsItemStartsWithX;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to use Linq LastOrDefault operator with condition&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Element Operator
            &amp;lt;br /&amp;gt; LastOrDefault With Condition
            &amp;lt;br /&amp;gt;How to get the last element of a sequence or
            &amp;lt;br /&amp;gt; a default value if no element is found
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="500" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkCyan"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - LastOrDefault"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-Ee8I7EqyNMg/TuI37LdwodI/AAAAAAAAJzg/sMX_-P79EE0/s1600/LinqLastOrDefaultOperatorWithCondition.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 271px;" src="http://1.bp.blogspot.com/-Ee8I7EqyNMg/TuI37LdwodI/AAAAAAAAJzg/sMX_-P79EE0/s400/LinqLastOrDefaultOperatorWithCondition.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684167169524408786" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-IMcl-Pkj1ZM/TuI4ClXZ4_I/AAAAAAAAJzs/cHx6zlOfk8g/s1600/LinqLastOrDefaultOperatorWithCondition1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 289px;" src="http://4.bp.blogspot.com/-IMcl-Pkj1ZM/TuI4ClXZ4_I/AAAAAAAAJzs/cHx6zlOfk8g/s400/LinqLastOrDefaultOperatorWithCondition1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684167296736158706" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8438901116530639810?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8438901116530639810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8438901116530639810'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/how-to-use-linq-lastordefault-operator.html' title='How to use Linq LastOrDefault operator with condition'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-Ee8I7EqyNMg/TuI37LdwodI/AAAAAAAAJzg/sMX_-P79EE0/s72-c/LinqLastOrDefaultOperatorWithCondition.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-4559629429484951508</id><published>2011-12-09T08:26:00.000-08:00</published><updated>2011-12-09T08:27:59.041-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq LastOrDefault Operator - How to get the last element of a sequence or a default value if no element is found</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq LastOrDefault Operator - How to get the last element of a sequence or a default value if no element is found
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqLastOrDefaultOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Litchibaum", "Litschipflaume", "Mangistan", "Manzana", "Matum", "Malay apple" };
        string[] emptyArray = {};

        string lastOrDefaultFruitsItem = (from f in fruits
                                           select f).LastOrDefault();

        string lastOrDefaultEmptyArrayItem = (from f in emptyArray
                                               select f).LastOrDefault();

        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling LastOrDefault Operator [fruits]: " + lastOrDefaultFruitsItem;
        Label2.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Calling LastOrDefault Operator [emptyArray]: " + lastOrDefaultEmptyArrayItem;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq LastOrDefault Operator - How to get the last element of a sequence or a default value if no element is found&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Element Operator - LastOrDefault
            &amp;lt;br /&amp;gt;How to get the last element of a sequence or
            &amp;lt;br /&amp;gt; a default value if no element is found
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="550" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkSeaGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - LastOrDefault"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-nsyDY0jD4PM/TuI21bLdF2I/AAAAAAAAJzI/Hy0JmIJiGYE/s1600/LinqLastOrDefaultOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 230px;" src="http://3.bp.blogspot.com/-nsyDY0jD4PM/TuI21bLdF2I/AAAAAAAAJzI/Hy0JmIJiGYE/s400/LinqLastOrDefaultOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684165971151755106" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-bo6N6DTo_uA/TuI28tBZlFI/AAAAAAAAJzU/MkWs354-v6Y/s1600/LinqLastOrDefaultOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 328px;" src="http://4.bp.blogspot.com/-bo6N6DTo_uA/TuI28tBZlFI/AAAAAAAAJzU/MkWs354-v6Y/s400/LinqLastOrDefaultOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684166096200504402" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-4559629429484951508?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4559629429484951508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4559629429484951508'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-lastordefault-operator-how-to-get.html' title='Linq LastOrDefault Operator - How to get the last element of a sequence or a default value if no element is found'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-nsyDY0jD4PM/TuI21bLdF2I/AAAAAAAAJzI/Hy0JmIJiGYE/s72-c/LinqLastOrDefaultOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8951900328331733833</id><published>2011-12-09T08:20:00.000-08:00</published><updated>2011-12-09T08:21:49.974-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>How to use Linq Last Operator with condition</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to use Linq Last Operator with condition
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqLastOperatorWithCondition.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Grenadier", "Fraisier", "Banane", "Common fig", "Borassus flabellifer", "Chicozapote" };

        string lastItem = (from f in fruits
                                select f).Last(f=&amp;gt;f.StartsWith("B"));

        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling Last Operator With Condition [StartsWith('B')]: &amp;lt;br /&amp;gt;" + lastItem;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to use Linq Last Operator with condition&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator
            &amp;lt;br /&amp;gt; Element Operator - Last With Condition
            &amp;lt;br /&amp;gt;How to get the last element of a sequence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="450" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Navy"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DeepPink"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Last"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-BrYbHeHGrrM/TuI1ZXEwCxI/AAAAAAAAJyw/Y8fqL-Des1U/s1600/LinqLastOperatorWithCondition.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 252px;" src="http://2.bp.blogspot.com/-BrYbHeHGrrM/TuI1ZXEwCxI/AAAAAAAAJyw/Y8fqL-Des1U/s400/LinqLastOperatorWithCondition.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684164389501930258" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-dukia3RUQF0/TuI1gJrY8nI/AAAAAAAAJy8/E4mdYUpYkTM/s1600/LinqLastOperatorWithCondition1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 331px;" src="http://1.bp.blogspot.com/-dukia3RUQF0/TuI1gJrY8nI/AAAAAAAAJy8/E4mdYUpYkTM/s400/LinqLastOperatorWithCondition1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684164506164982386" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8951900328331733833?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8951900328331733833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8951900328331733833'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/how-to-use-linq-last-operator-with.html' title='How to use Linq Last Operator with condition'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-BrYbHeHGrrM/TuI1ZXEwCxI/AAAAAAAAJyw/Y8fqL-Des1U/s72-c/LinqLastOperatorWithCondition.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8413591085584632508</id><published>2011-12-09T08:14:00.000-08:00</published><updated>2011-12-09T08:15:53.683-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Last Operator - How to get  the last element of a sequence</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Last Operator - How to get  the last element of a sequence
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqLastOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Achras zapota", "Appelsien", "Atte", "Bouea burmanica", "Buna", "Cerezo" };

        string lastItem = (from f in fruits
                                select f).Last();

        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling Last Operator: " + lastItem;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Last Operator - How to get  the last element of a sequence&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Element Operator - Last
            &amp;lt;br /&amp;gt;How to get  the last element of a sequence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="550" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DeepPink"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="PaleVioletRed"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Last"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-ovo7Vx-jN3M/TuIz-3yyBFI/AAAAAAAAJyY/3pnO-8FRfLI/s1600/LinqLastOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 239px;" src="http://2.bp.blogspot.com/-ovo7Vx-jN3M/TuIz-3yyBFI/AAAAAAAAJyY/3pnO-8FRfLI/s400/LinqLastOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684162834916836434" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-LiPSHS0h3ds/TuI0HPORnYI/AAAAAAAAJyk/6BtZml8nefQ/s1600/LinqFirstOrDefaultOperatorWithCondition1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 271px;" src="http://2.bp.blogspot.com/-LiPSHS0h3ds/TuI0HPORnYI/AAAAAAAAJyk/6BtZml8nefQ/s400/LinqFirstOrDefaultOperatorWithCondition1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684162978645122434" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8413591085584632508?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8413591085584632508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8413591085584632508'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-last-operator-how-to-get-last.html' title='Linq Last Operator - How to get  the last element of a sequence'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-ovo7Vx-jN3M/TuIz-3yyBFI/AAAAAAAAJyY/3pnO-8FRfLI/s72-c/LinqLastOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-1819398800075058950</id><published>2011-12-09T08:10:00.001-08:00</published><updated>2011-12-09T08:11:43.439-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>How to use Linq FirstOrDefault operator with condition</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to use Linq FirstOrDefault operator with condition
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqFirstOrDefaultOperatorWithCondition.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Manzana velvet", "Naranjo dulce", "Lychee", "Naranja", "Lamyai", "Kathon" };

        string firstOrDefaultFruitsItemStartsWithN = (from f in fruits
                                                     select f).FirstOrDefault(f =&amp;gt; f.StartsWith("N"));

        string firstOrDefaultFruitsItemStartsWithD = (from f in fruits
                                                     select f).FirstOrDefault(f =&amp;gt; f.StartsWith("D"));

        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling FirstOrDefault Operator With Condition [StartsWith('N')]: " + firstOrDefaultFruitsItemStartsWithN;
        Label2.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Calling FirstOrDefault Operator With Condition [StartsWith('D')]: " + firstOrDefaultFruitsItemStartsWithD;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to use Linq FirstOrDefault operator with condition&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Element Operator
            &amp;lt;br /&amp;gt; FirstOrDefault With Condition
            &amp;lt;br /&amp;gt;How to get the first element of a sequence
            &amp;lt;br /&amp;gt; or a default value if no element is found
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="500" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="SaddleBrown"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DodgerBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - FirstOrDefault"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-xWvVhhOQBvc/TuIzBI034DI/AAAAAAAAJyA/IH-QBz4f-R4/s1600/LinqFirstOrDefaultOperatorWithCondition.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 245px;" src="http://4.bp.blogspot.com/-xWvVhhOQBvc/TuIzBI034DI/AAAAAAAAJyA/IH-QBz4f-R4/s400/LinqFirstOrDefaultOperatorWithCondition.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684161774337122354" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-k0GXtmKaPB8/TuIzIINlOtI/AAAAAAAAJyM/56sprMmz0VQ/s1600/LinqFirstOrDefaultOperatorWithCondition1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 271px;" src="http://2.bp.blogspot.com/-k0GXtmKaPB8/TuIzIINlOtI/AAAAAAAAJyM/56sprMmz0VQ/s400/LinqFirstOrDefaultOperatorWithCondition1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684161894431406802" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-1819398800075058950?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1819398800075058950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1819398800075058950'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/how-to-use-linq-firstordefault-operator.html' title='How to use Linq FirstOrDefault operator with condition'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-xWvVhhOQBvc/TuIzBI034DI/AAAAAAAAJyA/IH-QBz4f-R4/s72-c/LinqFirstOrDefaultOperatorWithCondition.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8755961364936191077</id><published>2011-12-09T08:05:00.000-08:00</published><updated>2011-12-09T08:07:20.292-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq FirstOrDefault Operator - How to get the first element of a sequence or a default value if no element is found</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq FirstOrDefault Operator - How to get the first element of a sequence or a default value if no element is found
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqFirstOrDefaultOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Hibiscus sabdariffa", "Jambosa jambos", "Kasjoema", "Kokospalm", "Lansibaum" };
        string[] emptyArray = {};

        string firstOrDefaultFruitsItem = (from f in fruits
                                           select f).FirstOrDefault();

        string firstOrDefaultEmptyArrayItem = (from f in emptyArray
                                           select f).FirstOrDefault();

        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling FirstOrDefault Operator [fruits]: " + firstOrDefaultFruitsItem;
        Label2.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Calling FirstOrDefault Operator [emptyArray]: " + firstOrDefaultEmptyArrayItem;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq FirstOrDefault Operator - How to get the first element of a sequence or a default value if no element is found&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Element Operator - FirstOrDefault
            &amp;lt;br /&amp;gt;How to get the first element of a sequence
            &amp;lt;br /&amp;gt; or a default value if no element is found
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="550" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="HotPink"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Indigo"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - FirstOrDefault"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-vsdOA-7pWIc/TuIx_FuKrmI/AAAAAAAAJxo/QI-s-Iggrkw/s1600/LinqFirstOrDefaultOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 255px;" src="http://3.bp.blogspot.com/-vsdOA-7pWIc/TuIx_FuKrmI/AAAAAAAAJxo/QI-s-Iggrkw/s400/LinqFirstOrDefaultOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684160639632322146" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-cD3UFkYymmU/TuIyGke3wxI/AAAAAAAAJx0/YqAnA2uL1H0/s1600/LinqFirstOrDefaultOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 302px;" src="http://2.bp.blogspot.com/-cD3UFkYymmU/TuIyGke3wxI/AAAAAAAAJx0/YqAnA2uL1H0/s400/LinqFirstOrDefaultOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684160768148751122" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8755961364936191077?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8755961364936191077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8755961364936191077'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-firstordefault-operator-how-to-get.html' title='Linq FirstOrDefault Operator - How to get the first element of a sequence or a default value if no element is found'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-vsdOA-7pWIc/TuIx_FuKrmI/AAAAAAAAJxo/QI-s-Iggrkw/s72-c/LinqFirstOrDefaultOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-5714982183266228115</id><published>2011-12-09T08:01:00.000-08:00</published><updated>2011-12-09T08:02:55.121-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>How to use Linq First Operator with condition</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to use Linq First Operator with condition
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqFirstOperatorWithCondition.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Litchi chevelu", "Mangostino", "Actinidia", "Albicocco", "Breadnut", "Citrus maxima" };

        string firstItem = (from f in fruits
                                select f).First(f=&amp;gt;f.StartsWith("A"));

        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling First Operator With Condition [StartsWith('A')]: &amp;lt;br /&amp;gt;" + firstItem;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to use Linq First Operator with condition&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator
            &amp;lt;br /&amp;gt; Element Operator - First With Condition
            &amp;lt;br /&amp;gt;How to get the first element of a sequence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="450" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="RoyalBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Crimson"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - First"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-OoZDy32UZZU/TuIw9lbw4yI/AAAAAAAAJxQ/JzVpiwFLi78/s1600/LinqFirstOperatorWithCondition.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 263px;" src="http://3.bp.blogspot.com/-OoZDy32UZZU/TuIw9lbw4yI/AAAAAAAAJxQ/JzVpiwFLi78/s400/LinqFirstOperatorWithCondition.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684159514273702690" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-liScjvHXiMI/TuIxE5zqzoI/AAAAAAAAJxc/dP0HbqOf-IE/s1600/LinqFirstOperatorWithCondition1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 327px;" src="http://2.bp.blogspot.com/-liScjvHXiMI/TuIxE5zqzoI/AAAAAAAAJxc/dP0HbqOf-IE/s400/LinqFirstOperatorWithCondition1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684159640001760898" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-5714982183266228115?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5714982183266228115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5714982183266228115'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/how-to-use-linq-first-operator-with.html' title='How to use Linq First Operator with condition'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-OoZDy32UZZU/TuIw9lbw4yI/AAAAAAAAJxQ/JzVpiwFLi78/s72-c/LinqFirstOperatorWithCondition.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8728092454322070793</id><published>2011-12-09T07:56:00.000-08:00</published><updated>2011-12-09T07:58:46.423-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq First Operator - How to get the first element of a sequence</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq First Operator - How to get the first element of a sequence
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqFirstOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Stervrucht", "Punica granatum", "Persea americana", "Oranger", "Marian plum", "Mandarin" };

        string firstItem = (from f in fruits
                                select f).First();

        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling First Operator: " + firstItem;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq First Operator - How to get the first element of a sequence&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Element Operator - First
            &amp;lt;br /&amp;gt;How to get the first element of a sequence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="550" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="HotPink"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Indigo"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - First"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-_TI-8xkg4a8/TuIv6kBuKJI/AAAAAAAAJw4/EeloQmM96GU/s1600/LinqFirstOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 262px;" src="http://1.bp.blogspot.com/-_TI-8xkg4a8/TuIv6kBuKJI/AAAAAAAAJw4/EeloQmM96GU/s400/LinqFirstOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684158362844801170" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-kQPkGW71QKo/TuIwCzW2jcI/AAAAAAAAJxI/GR-cfRQoerU/s1600/LinqFirstOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 321px;" src="http://2.bp.blogspot.com/-kQPkGW71QKo/TuIwCzW2jcI/AAAAAAAAJxI/GR-cfRQoerU/s400/LinqFirstOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684158504398917058" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8728092454322070793?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8728092454322070793'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8728092454322070793'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-first-operator-how-to-get-first.html' title='Linq First Operator - How to get the first element of a sequence'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-_TI-8xkg4a8/TuIv6kBuKJI/AAAAAAAAJw4/EeloQmM96GU/s72-c/LinqFirstOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8192094854028006072</id><published>2011-12-09T07:50:00.000-08:00</published><updated>2011-12-09T07:53:02.132-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq ElementAt Operator - How to get the element at a given index in a sequence</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq ElementAt Operator - How to get the element at a given index in a sequence
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqElementAtOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Fresa", "Feige", "Grosella espinosa", "Jujube", "Kraton", "Longkong" };

        string elementAt2 = (from f in fruits
                            select f).ElementAt(2);

        Label1.Text = "Fruits List:....... &amp;lt;br /&amp;gt;";
        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling ElementAt(2) Operator: " + elementAt2;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq ElementAt Operator - How to get the element at a given index in a sequence&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Element Operator - ElementAt
            &amp;lt;br /&amp;gt;How to get the element at a given index in a sequence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="600" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkMagenta"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="MediumBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - ElementAt"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-i8kLZgTdHi8/TuIuXZn4r2I/AAAAAAAAJwg/5ZVyYPj9qrw/s1600/LinqElementAtOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 231px;" src="http://2.bp.blogspot.com/-i8kLZgTdHi8/TuIuXZn4r2I/AAAAAAAAJwg/5ZVyYPj9qrw/s400/LinqElementAtOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684156659245035362" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-X6V6Y8FDofo/TuIuoLlbF9I/AAAAAAAAJws/GSOLn8-OQYw/s1600/LinqElementAtOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 297px;" src="http://4.bp.blogspot.com/-X6V6Y8FDofo/TuIuoLlbF9I/AAAAAAAAJws/GSOLn8-OQYw/s400/LinqElementAtOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5684156947534387154" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8192094854028006072?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8192094854028006072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8192094854028006072'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-elementat-operator-how-to-get.html' title='Linq ElementAt Operator - How to get the element at a given index in a sequence'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-i8kLZgTdHi8/TuIuXZn4r2I/AAAAAAAAJwg/5ZVyYPj9qrw/s72-c/LinqElementAtOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-1262466229246751380</id><published>2011-12-08T07:44:00.001-08:00</published><updated>2011-12-08T07:45:35.557-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq SkipWhile Operator - How to get a sequence that skips items that do not meet an expression</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq SkipWhile Operator - How to get a sequence that skips items that do not meet an expression
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqSkipWhileOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        int[] nums = { 51,210,55,29,125,15,177,50 };

        IEnumerable&amp;lt;int&amp;gt; val = nums.OrderBy(n=&amp;gt; n).SkipWhile(n =&amp;gt; n&amp;lt;100);

        Label1.Text = "Numbers List: &amp;lt;br /&amp;gt;";

        foreach (int i in nums)
        {
            Label1.Text += i.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling SkipWhile(number&amp;lt;100) Operator: &amp;lt;br /&amp;gt;";
        foreach (int n in val)
        {
            Label2.Text += n.ToString() + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq SkipWhile Operator - How to get a sequence that skips items that do not meet an expression&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Partitioning Operator - SkipWhile
            &amp;lt;br /&amp;gt;How to get a sequence that skips items that do not meet an expression
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="650" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkOliveGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkOrchid"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - SkipWhile"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-xz9CIotHsCQ/TuDbYNzvspI/AAAAAAAAJwI/DttZaIQaohc/s1600/LinqSkipWhileOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 264px;" src="http://2.bp.blogspot.com/-xz9CIotHsCQ/TuDbYNzvspI/AAAAAAAAJwI/DttZaIQaohc/s400/LinqSkipWhileOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683783938811605650" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-SLzasfocxmc/TuDbff4JkvI/AAAAAAAAJwU/l1eaanf5CWY/s1600/LinqSkipWhileOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 340px;" src="http://1.bp.blogspot.com/-SLzasfocxmc/TuDbff4JkvI/AAAAAAAAJwU/l1eaanf5CWY/s400/LinqSkipWhileOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683784063921001202" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-1262466229246751380?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1262466229246751380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1262466229246751380'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-skipwhile-operator-how-to-get.html' title='Linq SkipWhile Operator - How to get a sequence that skips items that do not meet an expression'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-xz9CIotHsCQ/TuDbYNzvspI/AAAAAAAAJwI/DttZaIQaohc/s72-c/LinqSkipWhileOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8791886140300819424</id><published>2011-12-08T07:39:00.000-08:00</published><updated>2011-12-08T07:41:40.423-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Skip Operator - How to get a sequence that skips a given number of items</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Skip Operator - How to get a sequence that skips a given number of items
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqSkipOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Sternfrucht", "Syzygium jambos", "Wild mangosteen", "Yaca", "Zoetzak", "Witte druif" };

        IEnumerable&amp;lt;string&amp;gt; val = (from f in fruits
                                   select f).Skip(2);

        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";

        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling Skip(2) Operator: &amp;lt;br /&amp;gt;";
        foreach (string n in val)
        {
            Label2.Text += n.ToString() + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Skip Operator - How to get a sequence that skips a given number of items&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Partitioning Operator - Skip
            &amp;lt;br /&amp;gt;How to get a sequence that skips a given number of items
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="550" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkOliveGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Indigo"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Skip"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-oMAy3oxIRBE/TuDaaA7SgWI/AAAAAAAAJvw/qvAqHt2mank/s1600/LinqSkipOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 233px;" src="http://1.bp.blogspot.com/-oMAy3oxIRBE/TuDaaA7SgWI/AAAAAAAAJvw/qvAqHt2mank/s400/LinqSkipOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683782870201696610" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-drePaDeK-74/TuDaimoRg4I/AAAAAAAAJv8/d-vpZBZeNcg/s1600/LinqSkipOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 371px;" src="http://2.bp.blogspot.com/-drePaDeK-74/TuDaimoRg4I/AAAAAAAAJv8/d-vpZBZeNcg/s400/LinqSkipOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683783017761440642" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8791886140300819424?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8791886140300819424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8791886140300819424'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-skip-operator-how-to-get-sequence.html' title='Linq Skip Operator - How to get a sequence that skips a given number of items'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-oMAy3oxIRBE/TuDaaA7SgWI/AAAAAAAAJvw/qvAqHt2mank/s72-c/LinqSkipOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-1753901949075380393</id><published>2011-12-08T07:32:00.000-08:00</published><updated>2011-12-08T07:34:05.832-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Reverse Operator - How to reverse the order of the items in a sequence</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Reverse Operator - How to reverse the order of the items in a sequence
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqReverseOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Aprikose", "Coffee shrub of Arabia", "Bouea burmanica", "Kathal", "Jujube", "Lichi" };

        IEnumerable&amp;lt;string&amp;gt; val = fruits.Reverse();
        
        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";

        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling The Reverse Operator&amp;lt;br /&amp;gt;";

        foreach (string n in val)
        {
            Label2.Text += n + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Reverse Operator - How to reverse the order of the items in a sequence&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator - Reverse
            &amp;lt;br /&amp;gt;How to reverse the order of the items in a sequence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="500" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Maroon"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="SkyBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Reverse"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-74fEDR3pHCo/TuDYsMfet3I/AAAAAAAAJvY/gqiDcJbJ2d0/s1600/LinqReverseOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 233px;" src="http://1.bp.blogspot.com/-74fEDR3pHCo/TuDYsMfet3I/AAAAAAAAJvY/gqiDcJbJ2d0/s400/LinqReverseOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683780983520671602" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-f1AEpKjmTCc/TuDYzY1g_VI/AAAAAAAAJvk/WMup7Rk9g-A/s1600/LinqReverseOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 338px; height: 400px;" src="http://4.bp.blogspot.com/-f1AEpKjmTCc/TuDYzY1g_VI/AAAAAAAAJvk/WMup7Rk9g-A/s400/LinqReverseOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683781107093405010" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-1753901949075380393?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1753901949075380393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1753901949075380393'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-reverse-operator-how-to-reverse.html' title='Linq Reverse Operator - How to reverse the order of the items in a sequence'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-74fEDR3pHCo/TuDYsMfet3I/AAAAAAAAJvY/gqiDcJbJ2d0/s72-c/LinqReverseOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-3694708743583750927</id><published>2011-12-08T07:28:00.000-08:00</published><updated>2011-12-08T07:29:51.477-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Distinct Operator - How to get a sequence without duplicate items</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Distinct Operator - How to get a sequence without duplicate items
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqDistinctOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Junco", "Longan", "Junco", "Maprang", "Longan", "Junco" };

        IEnumerable&amp;lt;string&amp;gt; val = (from f in fruits
                                  select f).Distinct();
        
        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";

        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling The Distinct Operator&amp;lt;br /&amp;gt;";

        foreach (string n in val)
        {
            Label2.Text += n + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Distinct Operator - How to get a sequence without duplicate items&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator - Distinct
            &amp;lt;br /&amp;gt;How to get a sequence without duplicate items
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="500" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="PaleVioletRed"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="RoyalBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Distinct"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-9OScy4fKAXU/TuDXppLs5SI/AAAAAAAAJvA/AWs4nxXNQGo/s1600/LinqDistinctOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 242px;" src="http://1.bp.blogspot.com/-9OScy4fKAXU/TuDXppLs5SI/AAAAAAAAJvA/AWs4nxXNQGo/s400/LinqDistinctOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683779840171107618" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-czsMjp0KS6E/TuDXy5braoI/AAAAAAAAJvM/AOKTOZpNOLU/s1600/LinqDistinctOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 400px;" src="http://1.bp.blogspot.com/-czsMjp0KS6E/TuDXy5braoI/AAAAAAAAJvM/AOKTOZpNOLU/s400/LinqDistinctOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683779999151909506" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-3694708743583750927?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3694708743583750927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3694708743583750927'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-distinct-operator-how-to-get.html' title='Linq Distinct Operator - How to get a sequence without duplicate items'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-9OScy4fKAXU/TuDXppLs5SI/AAAAAAAAJvA/AWs4nxXNQGo/s72-c/LinqDistinctOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-1659656264063430527</id><published>2011-12-08T07:24:00.001-08:00</published><updated>2011-12-08T07:25:22.474-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Contains Operator - How to determine if a sequence contains a given item</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Contains Operator - How to determine if a sequence contains a given item
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqContainsOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Mabolo", "Mandarine", "Mango", "Mangue", "Naranjo", "Patilla" };

        Boolean isContainsPatilla = (from f in fruits
                                   select f).Any(f =&amp;gt; f.Contains("Patilla"));

        Boolean isContainsSusina = (from f in fruits
                                   select f).Any(f =&amp;gt; f.StartsWith("Susina"));

        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";

        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling Contains Operator [Contains('Patilla')]: " + isContainsPatilla.ToString();
        Label2.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Calling Contains Operator [Contains('Susina')]: " + isContainsSusina.ToString();
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Contains Operator - How to determine if a sequence contains a given item&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator - Contains
            &amp;lt;br /&amp;gt;How to determine if a sequence contains a given item
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="550" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Red"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Contains"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-EyXNyGTfyLQ/TuDWqkYg2iI/AAAAAAAAJuo/y7p4_bmnWeg/s1600/LinqContainsOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 246px;" src="http://1.bp.blogspot.com/-EyXNyGTfyLQ/TuDWqkYg2iI/AAAAAAAAJuo/y7p4_bmnWeg/s400/LinqContainsOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683778756550908450" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-GyEyg184oUE/TuDWw_ndN4I/AAAAAAAAJu0/mxy8R3B1heM/s1600/LinqContainsOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 340px;" src="http://3.bp.blogspot.com/-GyEyg184oUE/TuDWw_ndN4I/AAAAAAAAJu0/mxy8R3B1heM/s400/LinqContainsOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683778866940557186" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-1659656264063430527?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1659656264063430527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1659656264063430527'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-contains-operator-how-to-determine.html' title='Linq Contains Operator - How to determine if a sequence contains a given item'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-EyXNyGTfyLQ/TuDWqkYg2iI/AAAAAAAAJuo/y7p4_bmnWeg/s72-c/LinqContainsOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-5725008252535387626</id><published>2011-12-08T07:19:00.000-08:00</published><updated>2011-12-08T07:21:19.685-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Any Operator - How to determine if any items in a sequence meet a condition</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Any Operator - How to determine if any items in a sequence meet a condition
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqAnyOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Albicocco", "Brotfruchtbaum", "Chicozapote", "Coffea arabica", "Guanabana", "Lansibaum" };

        Boolean isAnyStratWithL = (from f in fruits
                                select f).Any(f =&amp;gt; f.StartsWith("L"));

        Boolean isAnyStratWithZ = (from f in fruits
                                select f).Any(f =&amp;gt; f.StartsWith("Z"));

        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";

        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling Any Operator [StartsWith('L')]: " + isAnyStratWithL.ToString();
        Label2.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Calling Any Operator [StartsWith('Z')]: " + isAnyStratWithZ.ToString();
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Any Operator - How to determine if any items in a sequence meet a condition&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Quantifier Operator - Any
            &amp;lt;br /&amp;gt;How to determine if any items in a sequence meet a condition
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="585" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Red"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Any"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-njUNVEhz2vU/TuDVs0fo1tI/AAAAAAAAJuQ/JD9bUmqFc-w/s1600/LinqAnyOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 219px;" src="http://2.bp.blogspot.com/-njUNVEhz2vU/TuDVs0fo1tI/AAAAAAAAJuQ/JD9bUmqFc-w/s400/LinqAnyOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683777695723869906" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-cpSBmKrb4yM/TuDV0t7atAI/AAAAAAAAJuc/Frc3xe7ELvE/s1600/LinqAnyOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 342px;" src="http://3.bp.blogspot.com/-cpSBmKrb4yM/TuDV0t7atAI/AAAAAAAAJuc/Frc3xe7ELvE/s400/LinqAnyOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683777831400289282" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-5725008252535387626?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5725008252535387626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5725008252535387626'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-any-operator-how-to-determine-if.html' title='Linq Any Operator - How to determine if any items in a sequence meet a condition'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-njUNVEhz2vU/TuDVs0fo1tI/AAAAAAAAJuQ/JD9bUmqFc-w/s72-c/LinqAnyOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-4580786907326690021</id><published>2011-12-08T07:14:00.000-08:00</published><updated>2011-12-08T07:16:37.881-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq All Operator - How to determine if all items in a sequence meet a condition</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq All Operator - How to determine if all items in a sequence meet a condition
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqAllOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Abricotier", "Abrikoos", "Actinidia", "Aguacate", "Alupag", "Anguria" };

        Boolean isStratWithA = (from f in fruits
                                select f).All(f =&amp;gt; f.StartsWith("A"));

        Boolean isStratWithB = (from f in fruits
                                select f).All(f =&amp;gt; f.StartsWith("B"));

        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";

        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "After Calling All Operator [StartsWith('A')]: " + isStratWithA.ToString();
        Label2.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Calling All Operator [StartsWith('B')]: " + isStratWithB.ToString();
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq All Operator - How to determine if all items in a sequence meet a condition&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator: Quantifier Operator - All
            &amp;lt;br /&amp;gt;How to determine if all items in a sequence meet a condition
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="575" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Crimson"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="RoyalBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - All"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-_eScdm80Y90/TuDUlrRpVUI/AAAAAAAAJt4/bReizStFzBw/s1600/LinqAllOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 220px;" src="http://2.bp.blogspot.com/-_eScdm80Y90/TuDUlrRpVUI/AAAAAAAAJt4/bReizStFzBw/s400/LinqAllOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683776473478550850" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-OZpHfBC3rWY/TuDUtGfNuCI/AAAAAAAAJuE/DhAQy0ysqqs/s1600/LinqAllOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 345px;" src="http://4.bp.blogspot.com/-OZpHfBC3rWY/TuDUtGfNuCI/AAAAAAAAJuE/DhAQy0ysqqs/s400/LinqAllOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683776601042303010" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-4580786907326690021?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4580786907326690021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4580786907326690021'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-all-operator-how-to-determine-if.html' title='Linq All Operator - How to determine if all items in a sequence meet a condition'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-_eScdm80Y90/TuDUlrRpVUI/AAAAAAAAJt4/bReizStFzBw/s72-c/LinqAllOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-907547131916002752</id><published>2011-12-07T07:58:00.001-08:00</published><updated>2011-12-07T07:59:50.747-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Sum Operator - How to get sums the numbers in a sequence</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Sum Operator - How to get sums the numbers in a sequence
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqSumOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        int[] prices = {125,442,21,89,142,334,19};

        Label1.Text = "Price List: &amp;lt;br /&amp;gt;";

        foreach (int n in prices)
        {
            Label1.Text += n.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "Sum of the Prices: " + prices.Sum().ToString(); ;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Sum Operator - How to get sums the numbers in a sequence&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator - Sum
            &amp;lt;br /&amp;gt;How to get sums the numbers in a sequence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="425" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkOrchid"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="SeaGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Sum"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-kkyabZjb_vw/Tt-NMtknmfI/AAAAAAAAJtg/RnLjVsLP7EM/s1600/LinqSumOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 255px;" src="http://3.bp.blogspot.com/-kkyabZjb_vw/Tt-NMtknmfI/AAAAAAAAJtg/RnLjVsLP7EM/s400/LinqSumOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683416504295987698" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-SrrWJck0UmE/Tt-NUT8ws0I/AAAAAAAAJts/duuEG3tCGSE/s1600/LinqSumOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 395px; height: 400px;" src="http://3.bp.blogspot.com/-SrrWJck0UmE/Tt-NUT8ws0I/AAAAAAAAJts/duuEG3tCGSE/s400/LinqSumOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683416634856878914" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-907547131916002752?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/907547131916002752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/907547131916002752'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-sum-operator-how-to-get-sums.html' title='Linq Sum Operator - How to get sums the numbers in a sequence'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-kkyabZjb_vw/Tt-NMtknmfI/AAAAAAAAJtg/RnLjVsLP7EM/s72-c/LinqSumOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-5518940786802959540</id><published>2011-12-07T07:53:00.000-08:00</published><updated>2011-12-07T07:55:37.267-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq select operator - How to create a projection of parts of a sequence</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq select operator - How to create a projection of parts of a sequence
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqSelectOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Abricot", "Coconut palm", "Ficus carica", "Guanabana", "Albaricoque" };

        IEnumerable&amp;lt;string&amp;gt; val = from f in fruits
                                  where f.StartsWith("A")
                                  select f;
        
        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";

        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "Filtered Fruits: StartsWith 'A'&amp;lt;br /&amp;gt;";

        foreach (string n in val)
        {
            Label2.Text += n + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq select operator - How to create a projection of parts of a sequence&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator - select
            &amp;lt;br /&amp;gt;How to create a projection of parts of a sequence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="450" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkMagenta"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - select"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-LJnS0zu0e6Q/Tt-MHAC22YI/AAAAAAAAJtI/6Kvre8pz93g/s1600/LinqSelectOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 235px;" src="http://4.bp.blogspot.com/-LJnS0zu0e6Q/Tt-MHAC22YI/AAAAAAAAJtI/6Kvre8pz93g/s400/LinqSelectOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683415306663811458" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-n680dpwsoIM/Tt-MOgdxFFI/AAAAAAAAJtU/jRUDuzg2bFY/s1600/LinqSelectOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 389px;" src="http://1.bp.blogspot.com/-n680dpwsoIM/Tt-MOgdxFFI/AAAAAAAAJtU/jRUDuzg2bFY/s400/LinqSelectOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683415435625698386" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-5518940786802959540?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5518940786802959540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5518940786802959540'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-select-operator-how-to-create.html' title='Linq select operator - How to create a projection of parts of a sequence'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-LJnS0zu0e6Q/Tt-MHAC22YI/AAAAAAAAJtI/6Kvre8pz93g/s72-c/LinqSelectOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-4981840161308748864</id><published>2011-12-07T07:49:00.000-08:00</published><updated>2011-12-07T07:51:01.948-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq orderby operator - How to order a sequence by values in ascending order</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq orderby operator - How to order a sequence by values in ascending order
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqOrderByOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Karambole", "Jabong", "Mandarijn", "Pitahaya", "Nektarine", "Banana" };

        IEnumerable&amp;lt;string&amp;gt; val = from f in fruits
                                  where f.Count()&amp;gt;6
                                  orderby f
                                  select f;
        
        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";

        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "Filtered And Ascending Ordered Fruits: Count()&amp;gt;6 &amp;lt;br /&amp;gt;";

        foreach (string n in val)
        {
            Label2.Text += n + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq orderby operator - How to order a sequence by values in ascending order&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator - orderby
            &amp;lt;br /&amp;gt;How to order a sequence by values in ascending order
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="500" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Olive"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkRed"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - orderby"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-tQ_aL1bmdhg/Tt-LJDFqkHI/AAAAAAAAJsw/dXO_eobUFRo/s1600/LinqOrderByOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 228px;" src="http://4.bp.blogspot.com/-tQ_aL1bmdhg/Tt-LJDFqkHI/AAAAAAAAJsw/dXO_eobUFRo/s400/LinqOrderByOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683414242329006194" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-xvKUWEGwoko/Tt-LQI7qfoI/AAAAAAAAJs8/cS7pn7Rn3KQ/s1600/LinqOrderByOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 390px;" src="http://4.bp.blogspot.com/-xvKUWEGwoko/Tt-LQI7qfoI/AAAAAAAAJs8/cS7pn7Rn3KQ/s400/LinqOrderByOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683414364156755586" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-4981840161308748864?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4981840161308748864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4981840161308748864'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-orderby-operator-how-to-order.html' title='Linq orderby operator - How to order a sequence by values in ascending order'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-tQ_aL1bmdhg/Tt-LJDFqkHI/AAAAAAAAJsw/dXO_eobUFRo/s72-c/LinqOrderByOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-7028635669904820463</id><published>2011-12-07T07:44:00.000-08:00</published><updated>2011-12-07T07:46:12.092-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq OrderByDescending Operator - How to order a sequence by values in descending order</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq OrderByDescending Operator - How to order a sequence by values in descending order
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqOrderByDescendingOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] fruits = { "Birne", "Achras zapota", "Wood apple", "Tamarindenbaum", "Kasjoema", "Coffee" };

        IEnumerable&amp;lt;string&amp;gt; val = from f in fruits
                                  where f.Count()&amp;gt;5
                                  orderby f descending
                                  select f;
        
        Label1.Text = "Fruits List: &amp;lt;br /&amp;gt;";

        foreach (string names in fruits)
        {
            Label1.Text += names.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "Filtered And Descending Ordered Fruits: Count()&amp;gt;5 &amp;lt;br /&amp;gt;";

        foreach (string n in val)
        {
            Label2.Text += n + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq OrderByDescending Operator - How to order a sequence by values in descending order&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator - OrderByDescending
            &amp;lt;br /&amp;gt;How to order a sequence by values in descending order
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="500" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Magenta"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="MediumBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - OrderByDescending"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-xRiGfZpUL8I/Tt-KAyIH3yI/AAAAAAAAJsY/3b-k5YjYcoo/s1600/LinqOrderByDescendingOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 220px;" src="http://4.bp.blogspot.com/-xRiGfZpUL8I/Tt-KAyIH3yI/AAAAAAAAJsY/3b-k5YjYcoo/s400/LinqOrderByDescendingOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683413000825331490" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-a20Msw5S9NQ/Tt-KIlvWCJI/AAAAAAAAJsk/e49TAfPkyy4/s1600/LinqOrderByDescendingOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 374px; height: 400px;" src="http://2.bp.blogspot.com/-a20Msw5S9NQ/Tt-KIlvWCJI/AAAAAAAAJsk/e49TAfPkyy4/s400/LinqOrderByDescendingOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683413134939130002" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-7028635669904820463?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/7028635669904820463'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/7028635669904820463'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-orderbydescending-operator-how-to.html' title='Linq OrderByDescending Operator - How to order a sequence by values in descending order'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-xRiGfZpUL8I/Tt-KAyIH3yI/AAAAAAAAJsY/3b-k5YjYcoo/s72-c/LinqOrderByDescendingOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-2075773806176209079</id><published>2011-12-07T07:39:00.000-08:00</published><updated>2011-12-07T07:41:12.701-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Min Operator - How to get the minimum number of a sequence of numbers</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Min Operator - How to get the minimum number of a sequence of numbers
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqMinOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        int[] numbers = {47,13,16,54,41,32,99};

        Label1.Text = "Numbers List: &amp;lt;br /&amp;gt;";

        foreach (int n in numbers)
        {
            Label1.Text += n.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "Minimum Value in Numbers: " + numbers.Min().ToString(); ;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Min Operator - How to get the minimum number of a sequence of numbers&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator - Min
            &amp;lt;br /&amp;gt;How to get the minimum number
            &amp;lt;br /&amp;gt; of a sequence of numbers
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="375" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="Violet"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="OliveDrab"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Min"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-1aveW_oljVQ/Tt-I2Rqb80I/AAAAAAAAJsA/yDe2o9PPqww/s1600/LinqMinOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 248px;" src="http://2.bp.blogspot.com/-1aveW_oljVQ/Tt-I2Rqb80I/AAAAAAAAJsA/yDe2o9PPqww/s400/LinqMinOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683411720800564034" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-udR1K8HObJI/Tt-I98-T2JI/AAAAAAAAJsM/pybIs7S5VG0/s1600/LinqMinOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 371px; height: 400px;" src="http://4.bp.blogspot.com/-udR1K8HObJI/Tt-I98-T2JI/AAAAAAAAJsM/pybIs7S5VG0/s400/LinqMinOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683411852685727890" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-2075773806176209079?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/2075773806176209079'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/2075773806176209079'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-min-operator-how-to-get-minimum.html' title='Linq Min Operator - How to get the minimum number of a sequence of numbers'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-1aveW_oljVQ/Tt-I2Rqb80I/AAAAAAAAJsA/yDe2o9PPqww/s72-c/LinqMinOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-2797739248840698907</id><published>2011-12-07T07:35:00.000-08:00</published><updated>2011-12-07T07:37:00.653-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Max Operator - How to get the maximum number of a sequence of numbers</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Max Operator - How to get the maximum number of a sequence of numbers
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqMaxOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        int[] myNums = {27,26,19,56,47,23,33};

        Label1.Text = "Numbers List: &amp;lt;br /&amp;gt;";

        foreach (int n in myNums)
        {
            Label1.Text += n.ToString() + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "Maximum Value in Numbers: " + myNums.Max().ToString(); ;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Max Operator - How to get the maximum number of a sequence of numbers&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator - Max
            &amp;lt;br /&amp;gt;How to get the maximum number
            &amp;lt;br /&amp;gt; of a sequence of numbers
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="375" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="X-Large"
             ForeColor="IndianRed"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DodgerBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Max"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-y1WSdWA0tFI/Tt-H1_05d1I/AAAAAAAAJro/g1Ezul8aWUU/s1600/LinqMaxOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 243px;" src="http://2.bp.blogspot.com/-y1WSdWA0tFI/Tt-H1_05d1I/AAAAAAAAJro/g1Ezul8aWUU/s400/LinqMaxOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683410616500975442" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-e2WMsRLcgTM/Tt-H-k-SWhI/AAAAAAAAJr0/AOOMueteNso/s1600/LinqMaxOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 376px; height: 400px;" src="http://2.bp.blogspot.com/-e2WMsRLcgTM/Tt-H-k-SWhI/AAAAAAAAJr0/AOOMueteNso/s400/LinqMaxOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683410763911420434" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-2797739248840698907?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/2797739248840698907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/2797739248840698907'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-max-operator-how-to-get-maximum.html' title='Linq Max Operator - How to get the maximum number of a sequence of numbers'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-y1WSdWA0tFI/Tt-H1_05d1I/AAAAAAAAJro/g1Ezul8aWUU/s72-c/LinqMaxOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-741821006522366773</id><published>2011-12-07T07:30:00.000-08:00</published><updated>2011-12-07T07:31:53.645-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>How to use Linq</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to use Linq
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     HowToUseLinq.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] colors = {"Red","Green","Blue","Yellow","AliceBlue","Sky","SeaGreen","Orange","OrangeRed" };
        IEnumerable&amp;lt;string&amp;gt; filteredColors = Enumerable.Where(colors, n =&amp;gt; n.Length &amp;gt;= 6);

        Label1.Text = "Color List &amp;lt;br /&amp;gt;";

        foreach (string n in colors)
        {
            Label1.Text += n + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "Filtered Colors: Length&amp;gt;=6&amp;lt;br /&amp;gt;";

        foreach (string n in filteredColors)
        {
            Label2.Text += n + "&amp;lt;br /&amp;gt;";
        }
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to use Linq&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            How to use Linq in asp.net
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="325" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="Large"
             ForeColor="HotPink"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="X-Large"
             ForeColor="DarkGreen"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Filter Colors"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-ffFu08bru6c/Tt-Gq5fWu3I/AAAAAAAAJrQ/EkHqhZas140/s1600/HowToUseLinq.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 238px;" src="http://3.bp.blogspot.com/-ffFu08bru6c/Tt-Gq5fWu3I/AAAAAAAAJrQ/EkHqhZas140/s400/HowToUseLinq.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683409326309817202" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-ZKlxzO_Udz0/Tt-GyOCLFFI/AAAAAAAAJrc/z4hT4LF6Wj8/s1600/HowToUseLinq1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 333px; height: 400px;" src="http://1.bp.blogspot.com/-ZKlxzO_Udz0/Tt-GyOCLFFI/AAAAAAAAJrc/z4hT4LF6Wj8/s400/HowToUseLinq1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5683409452083647570" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-741821006522366773?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/741821006522366773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/741821006522366773'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/how-to-use-linq.html' title='How to use Linq'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-ffFu08bru6c/Tt-Gq5fWu3I/AAAAAAAAJrQ/EkHqhZas140/s72-c/HowToUseLinq.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-1903898908705458963</id><published>2011-12-03T12:13:00.000-08:00</published><updated>2011-12-03T12:17:34.818-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq Example'/><title type='text'>Linq Count Operator - How to get the number of the items in a sequence as an int</title><content type='html'>&lt;div class="aspposttitle"&gt;
Linq Count Operator - How to get the number of the items in a sequence as an int
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     LinqCountOperator.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;
&amp;lt;%@ Import Namespace="System.Linq" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        string[] colors = {"Red","SkyBlue","SeaGreen","Orange","Salmon" };
        IEnumerable&amp;lt;string&amp;gt; filteredColors = from color in colors
                                             where color.StartsWith("S")
                                             select color ;

        Label1.Text = "Color List: &amp;lt;br /&amp;gt;";

        foreach (string n in colors)
        {
            Label1.Text += n + "&amp;lt;br /&amp;gt;";
        }

        Label2.Text = "Filtered Colors: StartsWith(S) &amp;lt;br /&amp;gt;";

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

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Linq Count Operator - How to get the number of the items in a sequence as an int&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:DarkBlue; font-style:italic;"&amp;gt;
            Linq Standard Query Operator - Count
            &amp;lt;br /&amp;gt;How to get the number of the items
            &amp;lt;br /&amp;gt; in a sequence as an int
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="375" align="left" color="CornFlowerBlue" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             Font-Size="Large"
             ForeColor="OrangeRed"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label2"
             runat="server"
             Font-Size="Large"
             ForeColor="DodgerBlue"
             Font-Italic="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Linq Query Operator - Count"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-Xn0eOSYVRpk/TtqDE1Gn6KI/AAAAAAAAJq4/wRjQMCp2Dqc/s1600/LinqCountOperator.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 233px;" src="http://3.bp.blogspot.com/-Xn0eOSYVRpk/TtqDE1Gn6KI/AAAAAAAAJq4/wRjQMCp2Dqc/s400/LinqCountOperator.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5681997998878877858" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-XRj21qpa3jw/TtqDMqE4QqI/AAAAAAAAJrE/VqlEFI5Q7OY/s1600/LinqCountOperator1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 359px; height: 400px;" src="http://3.bp.blogspot.com/-XRj21qpa3jw/TtqDMqE4QqI/AAAAAAAAJrE/VqlEFI5Q7OY/s400/LinqCountOperator1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5681998133357724322" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-1903898908705458963?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1903898908705458963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1903898908705458963'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/12/linq-count-operator-how-to-get-number.html' title='Linq Count Operator - How to get the number of the items in a sequence as an int'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-Xn0eOSYVRpk/TtqDE1Gn6KI/AAAAAAAAJq4/wRjQMCp2Dqc/s72-c/LinqCountOperator.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-876308277503713610</id><published>2011-10-16T12:53:00.001-07:00</published><updated>2011-11-30T07:57:16.226-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>Stack ToArray() Method - How to copy the Stack to a new array</title><content type='html'>&lt;div class="aspposttitle"&gt;
Stack ToArray() Method - How to copy the Stack to a new array
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     StackToArrayMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack();

        colors.Push("DarkRed");
        colors.Push("DarkGreen");
        colors.Push("DarkBlue");
        colors.Push("DarkSalmon");
        colors.Push("DarkViolet");

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=DarkViolet&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        var colorsArray = colors.ToArray();

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call Stack.ToArray() method";
        Label1.Text += "&amp;lt;br /&amp;gt;Array Elements...";
        Label1.Text += "&amp;lt;font color=DarkViolet&amp;gt;";
        for (int i = 0; i &amp;lt; colorsArray.Length; i++)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + colorsArray[i].ToString();
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Stack ToArray() Method - How to copy the Stack to a new array&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack ToArray() Method
            &amp;lt;br /&amp;gt; How to copy the Stack to a new array
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="400" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DarkGreen"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Stack ToArray() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-oYq1m4qGMHo/Tps2NwLCnCI/AAAAAAAAJgA/BRN5kWNvHSc/s1600/StackToArrayMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 254px;" src="http://3.bp.blogspot.com/-oYq1m4qGMHo/Tps2NwLCnCI/AAAAAAAAJgA/BRN5kWNvHSc/s400/StackToArrayMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664180566245940258" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/--x_X7yki65g/Tps2UzRcBpI/AAAAAAAAJgM/knILiRiAOJ8/s1600/StackToArrayMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 376px; height: 400px;" src="http://1.bp.blogspot.com/--x_X7yki65g/Tps2UzRcBpI/AAAAAAAAJgM/knILiRiAOJ8/s400/StackToArrayMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664180687337162386" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-bulletedlist-with_09.html"&gt;How to DataBind BulletedList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-radiobuttonlist-with_09.html"&gt;How to DataBind RadioButtonList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/10/xslt-xslsort-how-to-sort-data-in-xslt.html"&gt;XSLT xsl:sort - How to sort data in xslt&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-elements-from.html"&gt;How to remove all elements from the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-arraylist-to-compatible.html"&gt;How to copy ArrayList to a compatible Array, starting at the specified index of the array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/11/xmldocument-load-xmldocument-from.html"&gt;XmlDocument - Load XmlDocument from XmlReader and use XPath&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-use-systemcollectionsarraylist.html"&gt;How to use System.Collections.ArrayList IndexOf(Object, Int32, Int32) Method&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/11/xmldocument-documentelement-how-to-get.html"&gt;XmlDocument DocumentElement - How to get root Xml Element (root node) programmatically&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-element-at-specified.html"&gt;How to remove the element at the specified index of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-push-method-how-to-insert-object.html"&gt;Stack Push() Method - How to insert an object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-876308277503713610?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/876308277503713610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/876308277503713610'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/stack-toarray-method-how-to-copy-stack.html' title='Stack ToArray() Method - How to copy the Stack to a new array'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-oYq1m4qGMHo/Tps2NwLCnCI/AAAAAAAAJgA/BRN5kWNvHSc/s72-c/StackToArrayMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-6751762283733996489</id><published>2011-10-16T12:48:00.000-07:00</published><updated>2011-11-30T07:55:43.622-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>Stack Push() Method - How to insert an object at the top of the Stack</title><content type='html'>&lt;div class="aspposttitle"&gt;
Stack Push() Method - How to insert an object at the top of the Stack
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     StackPushMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack();

        colors.Push("Blue");
        colors.Push("DodgerBlue");
        colors.Push("SkyBlue");
        colors.Push("LightBlue");
        colors.Push("DeepSkyBlue");

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=DarkOrchid&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        colors.Push("MidnightBlue");

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After inserting an object at the top of the Stack";
        Label1.Text += "&amp;lt;br /&amp;gt;using Push(object) method. Now Stack Elements...&amp;lt;br /&amp;gt;";
        Label1.Text += "&amp;lt;font color=DarkOrchid&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Stack Push() Method - How to insert an object at the top of the Stack&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack Push() Method
            &amp;lt;br /&amp;gt; How to insert an object at the top of the Stack
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="475" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DarkOliveGreen"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Stack Push() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-zDfds6hIvi0/Tps1Pm7V7AI/AAAAAAAAJfo/Q2jZ4NHelt8/s1600/StackPushMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 268px;" src="http://1.bp.blogspot.com/-zDfds6hIvi0/Tps1Pm7V7AI/AAAAAAAAJfo/Q2jZ4NHelt8/s400/StackPushMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664179498612288514" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-ZZGqALjiSjk/Tps1Wf-c6KI/AAAAAAAAJf0/VLaHnKRE6qU/s1600/StackPushMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 397px;" src="http://3.bp.blogspot.com/-ZZGqALjiSjk/Tps1Wf-c6KI/AAAAAAAAJf0/VLaHnKRE6qU/s400/StackPushMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664179617005365410" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-how-to-reverse-order-of.html"&gt;ArrayList - How to reverse the order of the elements in the specified range&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-elements-of-arraylist-to.html"&gt;How to copy the elements of the ArrayList to a new array of the specified element type&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/09/how-to-set-change-detailsview-alternate_7843.html"&gt;How to set change DetailsView alternate row font, text style  programmatically in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-create-read-only-copy-of.html"&gt;How to create a read-only copy of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/09/how-to-set-change-detailsview-pager_9419.html"&gt;How to set change DetailsView pager settings image url in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-empty.html"&gt;How to initialize a new instance of empty Stack class with specified initial capacity&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-bulletedlist-using.html"&gt;How to DataBind BulletedList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/10/how-to-delete-records-data-using.html"&gt;How to delete records (data) using GridView and SqlDataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-radiobuttonlist-using.html"&gt;How to DataBind RadioButtonList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-toarray-method-how-to-copy-stack.html"&gt;Stack ToArray() Method - How to copy the Stack to a new array&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-6751762283733996489?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/6751762283733996489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/6751762283733996489'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/stack-push-method-how-to-insert-object.html' title='Stack Push() Method - How to insert an object at the top of the Stack'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-zDfds6hIvi0/Tps1Pm7V7AI/AAAAAAAAJfo/Q2jZ4NHelt8/s72-c/StackPushMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-1190239307166315574</id><published>2011-10-16T12:44:00.001-07:00</published><updated>2011-11-30T07:51:27.541-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>Stack Pop() Method - How to remove and get the object at the top of the Stack</title><content type='html'>&lt;div class="aspposttitle"&gt;
Stack Pop() Method - How to remove and get the object at the top of the Stack
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     StackPopMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack();

        colors.Push("Orange");
        colors.Push("DarkOrange");
        colors.Push("OrangeRed");
        colors.Push("Salmon");
        colors.Push("DarkSalmon");
        colors.Push("LightSalmon");

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=DodgerBlue&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Remove and get the object at the top of the Stack";
        Label1.Text += "&amp;lt;br /&amp;gt;using Pop() method.... &amp;lt;br /&amp;gt;";
        Label1.Text += "&amp;lt;font color=DarkBlue&amp;gt;";
        Label1.Text += colors.Pop().ToString();
        Label1.Text += "&amp;lt;/font&amp;gt;";

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call Pop() Method, Now Stack Elements... ";
        Label1.Text += "&amp;lt;font color=DeepSkyBlue&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Stack Pop() Method - How to remove and get the object at the top of the Stack&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack Pop() Method
            &amp;lt;br /&amp;gt; How to remove and get the object at the top of the Stack
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="600" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="Tomato"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Stack Pop() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-y-dodPWsObw/Tps0JR9G5wI/AAAAAAAAJfQ/fngNLdjuCC8/s1600/StackPopMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 241px;" src="http://1.bp.blogspot.com/-y-dodPWsObw/Tps0JR9G5wI/AAAAAAAAJfQ/fngNLdjuCC8/s400/StackPopMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664178290391705346" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-oi0shfvvCgY/Tps0QU84lUI/AAAAAAAAJfc/IfNjVZwKooo/s1600/StackPopMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 393px;" src="http://3.bp.blogspot.com/-oi0shfvvCgY/Tps0QU84lUI/AAAAAAAAJfc/IfNjVZwKooo/s400/StackPopMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664178411455157570" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-empty.html"&gt;How to initialize a new instance of empty Stack class with specified initial capacity&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-determine-whether-element-is-in.html"&gt;How to determine whether an element is in the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/08/how-to-set-change-gridview-row-border_30.html"&gt;How to set change GridView row border color in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-bulletedlist-using.html"&gt;How to DataBind BulletedList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/09/how-to-set-change-detailsview-header_2265.html"&gt;How to set change DetailsView header row border width programmatically in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-checkboxlist-using.html"&gt;How to DataBind CheckBoxList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-radiobuttonlist-using.html"&gt;How to DataBind RadioButtonList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/09/how-to-set-change-detailsview-pager_615.html"&gt;How to set change DetailsView pager border style programmatically in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-stack-to-existing-one.html"&gt;How to copy Stack to an existing one-dimensional Array, starting at the specified array index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-peek-method-how-to-get-object-at.html"&gt;Stack Peek() Method - How to get the object at the top of the Stack without removing it&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-1190239307166315574?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1190239307166315574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1190239307166315574'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/stack-pop-method-how-to-remove-and-get.html' title='Stack Pop() Method - How to remove and get the object at the top of the Stack'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-y-dodPWsObw/Tps0JR9G5wI/AAAAAAAAJfQ/fngNLdjuCC8/s72-c/StackPopMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-5571891108075056584</id><published>2011-10-16T12:39:00.000-07:00</published><updated>2011-11-30T07:49:36.282-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>Stack Peek() Method - How to get the object at the top of the Stack without removing it</title><content type='html'>&lt;div class="aspposttitle"&gt;
Stack Peek() Method - How to get the object at the top of the Stack without removing it
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     StackPeekMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack();

        colors.Push("Green");
        colors.Push("SeaGreen");
        colors.Push("MediumSeaGreen");
        colors.Push("DarkGreen");
        colors.Push("LawnGreen");

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=SlateBlue&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Get the object at the top of the Stack";
        Label1.Text += "&amp;lt;br /&amp;gt;without removing it using Peek() method.... &amp;lt;br /&amp;gt;";
        Label1.Text += "&amp;lt;font color=SlateBlue&amp;gt;";
        Label1.Text += colors.Peek().ToString();
        Label1.Text += "&amp;lt;/font&amp;gt;";

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call Peek() Method, Now Stack Elements... ";
        Label1.Text += "&amp;lt;font color=SlateBlue&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Stack Peek() Method - How to get the object at the top of the Stack without removing it&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack Peek() Method
            &amp;lt;br /&amp;gt; How to get the object at the top of the Stack without removing it
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="625" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="MediumVioletRed"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Stack Peek() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-DU6w6oW4vI8/TpszHq-eq7I/AAAAAAAAJe4/rk4gmr5APcw/s1600/StackPeekMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 228px;" src="http://2.bp.blogspot.com/-DU6w6oW4vI8/TpszHq-eq7I/AAAAAAAAJe4/rk4gmr5APcw/s400/StackPeekMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664177163236977586" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-kUfJ0LUrrro/TpszOgQe4DI/AAAAAAAAJfE/M5pqYyuJkhU/s1600/StackPeekMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 354px;" src="http://2.bp.blogspot.com/-kUfJ0LUrrro/TpszOgQe4DI/AAAAAAAAJfE/M5pqYyuJkhU/s400/StackPeekMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664177280618782770" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-bulletedlist-with_09.html"&gt;How to DataBind BulletedList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-checkboxlist-with_09.html"&gt;How to DataBind CheckBoxList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/08/how-to-set-change-pager-settings-first.html"&gt;How to set change pager settings first page image url in GridView in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-radiobuttonlist-using.html"&gt;How to DataBind RadioButtonList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-stack-to-existing-one.html"&gt;How to copy Stack to an existing one-dimensional Array, starting at the specified array index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/08/how-to-set-change-gridview-header-font_26.html"&gt;How to set change GridView header font name programmatically in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-pop-method-how-to-remove-and-get.html"&gt;Stack Pop() Method - How to remove and get the object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/08/how-to-set-change-gridview-row-font_8897.html"&gt;How to set change GridView row font, text style programmatically in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-push-method-how-to-insert-object.html"&gt;Stack Push() Method - How to insert an object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-toarray-method-how-to-copy-stack.html"&gt;Stack ToArray() Method - How to copy the Stack to a new array&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-5571891108075056584?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5571891108075056584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5571891108075056584'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/stack-peek-method-how-to-get-object-at.html' title='Stack Peek() Method - How to get the object at the top of the Stack without removing it'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-DU6w6oW4vI8/TpszHq-eq7I/AAAAAAAAJe4/rk4gmr5APcw/s72-c/StackPeekMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-4017032030003293470</id><published>2011-10-16T12:35:00.000-07:00</published><updated>2011-11-30T07:47:27.276-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to copy Stack to an existing one-dimensional Array, starting at the specified array index</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to copy Stack to an existing one-dimensional Array, starting at the specified array index
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     StackCopyToMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack();

        colors.Push("Red");
        colors.Push("DarkRed");
        colors.Push("IndianRed");
        colors.Push("MediumVioletRed");

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=SlateBlue&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
        
        string[] redColors = new string[colors.Count];
        colors.CopyTo(redColors,0);

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call CopyTo(array, index 0) Method, Array Elements...";
        Label1.Text += "&amp;lt;font color=SlateBlue&amp;gt;";
        for(int i=0; i&amp;lt;redColors.Length; i++)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + redColors[i].ToString();
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to copy Stack to an existing one-dimensional Array, starting at the specified array index&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack CopyTo() Method
            &amp;lt;br /&amp;gt; How to copy the Stack to an existing
            &amp;lt;br /&amp;gt; one-dimensional Array, starting at the specified array index
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="575" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="MediumVioletRed"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Stack CopyTo() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-JSwWVg11nrE/TpsyGXzKoMI/AAAAAAAAJeg/-_3dA7oq3ms/s1600/StackCopyToMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 236px;" src="http://1.bp.blogspot.com/-JSwWVg11nrE/TpsyGXzKoMI/AAAAAAAAJeg/-_3dA7oq3ms/s400/StackCopyToMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664176041397756098" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-KY8lfz-nTzk/TpsyNfI9biI/AAAAAAAAJes/5gKQHb3O8qg/s1600/StackCopyToMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 304px;" src="http://4.bp.blogspot.com/-KY8lfz-nTzk/TpsyNfI9biI/AAAAAAAAJes/5gKQHb3O8qg/s400/StackCopyToMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664176163627298338" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-radiobuttonlist-with_09.html"&gt;How to DataBind RadioButtonList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-create-and-use-arraylist.html"&gt;How to create and use ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/04/how-to-set-change-panel-forecolor-text.html"&gt;How to set, change Panel ForeColor (text, font color)&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-elements-from.html"&gt;How to remove all elements from the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/04/how-to-set-change-image-style.html"&gt;How to set, change Image style programmatically&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-determine-whether-element-exists.html"&gt;How to determine whether an element exists in ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/05/xmlreader-how-to-read-and-process-xml_06.html"&gt;XmlReader: How to read and process Xml file element data in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-radiobuttonlist-using.html"&gt;How to DataBind RadioButtonList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-peek-method-how-to-get-object-at.html"&gt;Stack Peek() Method - How to get the object at the top of the Stack without removing it&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-pop-method-how-to-remove-and-get.html"&gt;Stack Pop() Method - How to remove and get the object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-4017032030003293470?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4017032030003293470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4017032030003293470'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-copy-stack-to-existing-one.html' title='How to copy Stack to an existing one-dimensional Array, starting at the specified array index'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-JSwWVg11nrE/TpsyGXzKoMI/AAAAAAAAJeg/-_3dA7oq3ms/s72-c/StackCopyToMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-3153334050680170913</id><published>2011-10-16T12:30:00.000-07:00</published><updated>2011-11-30T07:45:58.817-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to DataBind RadioButtonList using Stack DataSource</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to DataBind RadioButtonList using Stack DataSource
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     DataBindRadioButtonListUsingStack.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack();

        colors.Push("Sienna");
        colors.Push("SeaShell");
        colors.Push("Silver");
        colors.Push("PowderBlue");
        colors.Push("Plum");

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=HotPink&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        RadioButtonList1.DataSource = colors;
        RadioButtonList1.DataBind();
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to DataBind RadioButtonList using Stack DataSource&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack
            &amp;lt;br /&amp;gt; How to DataBind RadioButtonList using Stack DataSource
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="575" align="left" color="Navy" /&amp;gt;
        &amp;lt;asp:RadioButtonList
             ID="RadioButtonList1"
             runat="server"
             RepeatColumns="2"
             ForeColor="DarkOrchid"
             Font-Names="Courier New"
             Font-Size="Large"
             Font-Italic="true"
             BorderColor="Orchid"
             Width="300"
             BorderWidth="1"
             &amp;gt;
        &amp;lt;/asp:RadioButtonList&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="Navy"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="DataBind RadioButtonList Using Stack"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-DvFj2ZGwmI8/Tpsw8jUPVYI/AAAAAAAAJeI/6cAmowi0Dx4/s1600/DataBindRadioButtonListUsingStack.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 258px;" src="http://3.bp.blogspot.com/-DvFj2ZGwmI8/Tpsw8jUPVYI/AAAAAAAAJeI/6cAmowi0Dx4/s400/DataBindRadioButtonListUsingStack.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664174773178946946" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-E9adMyW4FSk/TpsxDW-lcJI/AAAAAAAAJeU/a9jYeh5pHnM/s1600/DataBindRadioButtonListUsingStack1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 293px;" src="http://4.bp.blogspot.com/-E9adMyW4FSk/TpsxDW-lcJI/AAAAAAAAJeU/a9jYeh5pHnM/s400/DataBindRadioButtonListUsingStack1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664174890125979794" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-arraylist-to-compatible.html"&gt;How to copy ArrayList to a compatible Array, starting at the specified index of the array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-get-arraylist-which-represents.html"&gt;How to get an ArrayList which represents a subset of the elements in the source ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/04/how-to-use-theme-and-skin-in-menu.html"&gt;How to use theme and skin in Menu control&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-use-systemcollectionsarraylist.html"&gt;How to use System.Collections.ArrayList IndexOf(Object, Int32, Int32) Method&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-insert-element-into-arraylist-at.html"&gt;How to insert an element into the ArrayList at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/04/how-to-set-change-calendar-font-size.html"&gt;How to set, change Calendar font size programmatically&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-stack-to-existing-one.html"&gt;How to copy Stack to an existing one-dimensional Array, starting at the specified array index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/04/how-to-set-change-fileupload-width.html"&gt;How to set, change FileUpload width programmatically&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-peek-method-how-to-get-object-at.html"&gt;Stack Peek() Method - How to get the object at the top of the Stack without removing it&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-pop-method-how-to-remove-and-get.html"&gt;Stack Pop() Method - How to remove and get the object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-3153334050680170913?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3153334050680170913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3153334050680170913'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-databind-radiobuttonlist-using.html' title='How to DataBind RadioButtonList using Stack DataSource'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-DvFj2ZGwmI8/Tpsw8jUPVYI/AAAAAAAAJeI/6cAmowi0Dx4/s72-c/DataBindRadioButtonListUsingStack.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8032661670092603568</id><published>2011-10-16T12:26:00.001-07:00</published><updated>2011-11-30T07:44:10.160-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to DataBind ListBox using Stack DataSource</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to DataBind ListBox using Stack DataSource
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     DataBindListBoxUsingStack.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack();

        colors.Push("Salmon");
        colors.Push("Cyan");
        colors.Push("DarkCyan");
        colors.Push("SandyBrown");
        colors.Push("Orange");

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=Olive&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        ListBox1.DataSource = colors;
        ListBox1.DataBind();
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to DataBind ListBox using Stack DataSource&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack
            &amp;lt;br /&amp;gt; How to DataBind ListBox using Stack DataSource
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="525" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:ListBox
             ID="ListBox1"
             runat="server"
             Font-Names="Comic Sans MS"
             Font-Size="Large"
             Font-Italic="true"
             Width="250"
             ForeColor="DarkOrange"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:ListBox&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="Crimson"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="DataBind ListBox Using Stack"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-WVrBASdXBxE/Tpsv8WmSIcI/AAAAAAAAJdw/IV8lf5IBL2o/s1600/DataBindListBoxUsingStack.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 286px;" src="http://1.bp.blogspot.com/-WVrBASdXBxE/Tpsv8WmSIcI/AAAAAAAAJdw/IV8lf5IBL2o/s400/DataBindListBoxUsingStack.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664173670253339074" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-ILEnhusMqGU/TpswCFIQ6ZI/AAAAAAAAJd8/DZ8XtDOVing/s1600/DataBindListBoxUsingStack1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 331px;" src="http://2.bp.blogspot.com/-ILEnhusMqGU/TpswCFIQ6ZI/AAAAAAAAJd8/DZ8XtDOVing/s400/DataBindListBoxUsingStack1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664173768643242386" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-element-at-specified.html"&gt;How to remove the element at the specified index of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-first-occurrence-of.html"&gt;How to remove first occurrence of a specific object from ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/04/how-to-set-change-treeview-style.html"&gt;How to set, change TreeView style programmatically&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-how-to-reverse-order-of.html"&gt;ArrayList - How to reverse the order of the elements in the specified range&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-setrange-how-to-copy-elements.html"&gt;ArrayList SetRange() - How to copy the elements of a collection over a range of elements in the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/04/how-to-use-iamge-as-path-separator-in.html"&gt;How to use iamge as path separator in SiteMapPath&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-bulletedlist-using.html"&gt;How to DataBind BulletedList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/04/how-to-set-change-menu-font-size.html"&gt;How to set, change Menu font size programmatically&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-checkboxlist-using.html"&gt;How to DataBind CheckBoxList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-dropdownlist-using.html"&gt;How to DataBind DropDownList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8032661670092603568?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8032661670092603568'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8032661670092603568'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-databind-listbox-using-stack.html' title='How to DataBind ListBox using Stack DataSource'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-WVrBASdXBxE/Tpsv8WmSIcI/AAAAAAAAJdw/IV8lf5IBL2o/s72-c/DataBindListBoxUsingStack.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8407172100914094271</id><published>2011-10-16T12:20:00.000-07:00</published><updated>2011-11-30T07:42:36.023-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to DataBind DropDownList using Stack DataSource</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to DataBind DropDownList using Stack DataSource
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     DataBindDropDownListUsingStack.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack();

        colors.Push("IndianRed");
        colors.Push("DarkGreen");
        colors.Push("SaddleBrown");
        colors.Push("DarkSalmon");
        colors.Push("DarkViolet");

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=DarkViolet&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        DropDownList1.DataSource = colors;
        DropDownList1.DataBind();
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to DataBind DropDownList using Stack DataSource&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack
            &amp;lt;br /&amp;gt; How to DataBind DropDownList using Stack DataSource
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="550" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:DropDownList
             ID="DropDownList1"
             runat="server"
             Font-Size="Large"
             Font-Names="Courier New"
             Width="250"
             ForeColor="HotPink"
             &amp;gt;
        &amp;lt;/asp:DropDownList&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DarkGreen"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="DataBind DropDownList Using Stack"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-_ZlBAkb_bJA/Tpsup3CzuSI/AAAAAAAAJdM/oXvDNt54XBA/s1600/DataBindDropDownListUsingStack.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 230px;" src="http://4.bp.blogspot.com/-_ZlBAkb_bJA/Tpsup3CzuSI/AAAAAAAAJdM/oXvDNt54XBA/s400/DataBindDropDownListUsingStack.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664172253033773346" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-0WOLuCjNLKI/TpsuwqDY1NI/AAAAAAAAJdY/93v5t3xrfzQ/s1600/DataBindDropDownListUsingStack1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 279px;" src="http://4.bp.blogspot.com/-0WOLuCjNLKI/TpsuwqDY1NI/AAAAAAAAJdY/93v5t3xrfzQ/s400/DataBindDropDownListUsingStack1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664172369805628626" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-LMkTMmLPbg8/Tpsu2dfhrXI/AAAAAAAAJdk/N8LmBI2AfAs/s1600/DataBindDropDownListUsingStack2.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 277px;" src="http://4.bp.blogspot.com/-LMkTMmLPbg8/Tpsu2dfhrXI/AAAAAAAAJdk/N8LmBI2AfAs/s400/DataBindDropDownListUsingStack2.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664172469513203058" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-elements-of-arraylist-to.html"&gt;How to copy the elements of the ArrayList to a new array of the specified element type&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-capacity-how-to-get-or-set.html"&gt;ArrayList Capacity - How to get or set number of elements that ArrayList can contain&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/04/how-to-use-theme-and-skin-in-hyperlink.html"&gt;How to use theme and skin in HyperLink&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-create-read-only-copy-of.html"&gt;How to create a read-only copy of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-item-property-how-to-get-or.html"&gt;ArrayList Item Property - How to get or set the element at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/04/how-to-set-change-treeview-border-color.html"&gt;How to set, change TreeView border color&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-bulletedlist-using.html"&gt;How to DataBind BulletedList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/04/how-to-set-change-treeview-node-indent.html"&gt;How to set, change TreeView node indent value (NodeIndent)&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-checkboxlist-using.html"&gt;How to DataBind CheckBoxList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-listbox-using-stack.html"&gt;How to DataBind ListBox using Stack DataSource&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8407172100914094271?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8407172100914094271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8407172100914094271'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-databind-dropdownlist-using.html' title='How to DataBind DropDownList using Stack DataSource'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-_ZlBAkb_bJA/Tpsup3CzuSI/AAAAAAAAJdM/oXvDNt54XBA/s72-c/DataBindDropDownListUsingStack.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-5475755082133272374</id><published>2011-10-16T12:15:00.001-07:00</published><updated>2011-11-30T07:41:01.311-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to DataBind CheckBoxList using Stack DataSource</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to DataBind CheckBoxList using Stack DataSource
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     DataBindCheckBoxListUsingStack.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack();

        colors.Push("MediumSeaGreen");
        colors.Push("Navy");
        colors.Push("RoyalBlue");
        colors.Push("White");
        colors.Push("GoldenRod");

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=PaleVioletRed&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        CheckBoxList1.DataSource = colors;
        CheckBoxList1.DataBind();
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to DataBind CheckBoxList using Stack DataSource&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack
            &amp;lt;br /&amp;gt; How to DataBind CheckBoxList using Stack DataSource
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="575" align="left" color="Navy" /&amp;gt;
        &amp;lt;asp:CheckBoxList
             ID="CheckBoxList1"
             runat="server"
             ForeColor="OliveDrab"
             RepeatColumns="2"
             Font-Names="Courier New"
             Font-Size="Large"
             &amp;gt;
        &amp;lt;/asp:CheckBoxList&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="Navy"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="DataBind CheckBoxList Using Stack"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-V8We1i5f6HI/TpstVNN-EeI/AAAAAAAAJc0/ugwGXcVhYdM/s1600/DataBindCheckBoxListUsingStack.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 229px;" src="http://4.bp.blogspot.com/-V8We1i5f6HI/TpstVNN-EeI/AAAAAAAAJc0/ugwGXcVhYdM/s400/DataBindCheckBoxListUsingStack.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664170798697288162" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-7lFOzyoLlbw/TpstcMS3qlI/AAAAAAAAJdA/oPkCvfK4dHY/s1600/DataBindCheckBoxListUsingStack1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 293px;" src="http://1.bp.blogspot.com/-7lFOzyoLlbw/TpstcMS3qlI/AAAAAAAAJdA/oPkCvfK4dHY/s400/DataBindCheckBoxListUsingStack1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664170918708488786" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-empty.html"&gt;How to initialize a new instance of empty Stack class with specified initial capacity&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-determine-whether-element-is-in.html"&gt;How to determine whether an element is in the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/03/how-to-set-change-textbox-font-name.html"&gt;How to set, change TextBox font name&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-bulletedlist-using.html"&gt;How to DataBind BulletedList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/03/how-to-show-tool-tip-tooltip-in-button.html"&gt;How to show tool tip (ToolTip) in Button control&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-dropdownlist-using.html"&gt;How to DataBind DropDownList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-listbox-using-stack.html"&gt;How to DataBind ListBox using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/03/how-to-use-theme-and-skin-id-skinid-in_31.html"&gt;How to use theme and skin id (SkinID) in LinkButton&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-push-method-how-to-insert-object.html"&gt;Stack Push() Method - How to insert an object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-toarray-method-how-to-copy-stack.html"&gt;Stack ToArray() Method - How to copy the Stack to a new array&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-5475755082133272374?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5475755082133272374'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5475755082133272374'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-databind-checkboxlist-using.html' title='How to DataBind CheckBoxList using Stack DataSource'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-V8We1i5f6HI/TpstVNN-EeI/AAAAAAAAJc0/ugwGXcVhYdM/s72-c/DataBindCheckBoxListUsingStack.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-4982792426585235209</id><published>2011-10-16T12:10:00.000-07:00</published><updated>2011-11-30T07:39:37.534-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to DataBind BulletedList using Stack DataSource</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to DataBind BulletedList using Stack DataSource
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     DataBindBulletedListUsingStack.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack();

        colors.Push("CornFlowerBlue");
        colors.Push("Cyan");
        colors.Push("DarkGray");
        colors.Push("Snow");
        colors.Push("SeaGreen");

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=DeepPink&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        BulletedList1.DataSource = colors;
        BulletedList1.DataBind();
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to DataBind BulletedList using Stack DataSource&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack
            &amp;lt;br /&amp;gt; How to DataBind BulletedList using Stack DataSource
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="525" align="left" color="Navy" /&amp;gt;
        &amp;lt;asp:BulletedList
             ID="BulletedList1"
             runat="server"
             Font-Names="Comic Sans MS"
             Font-Size="Large"
             Font-Italic="true"
             ForeColor="Green"
             BulletStyle="LowerRoman"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:BulletedList&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DarkBlue"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="DataBind BulletedList Using Stack"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-ZSmAzGy04d4/TpssUiHCvFI/AAAAAAAAJcc/W2ATYBkSOtw/s1600/DataBindBulletedListUsingStack.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 239px;" src="http://2.bp.blogspot.com/-ZSmAzGy04d4/TpssUiHCvFI/AAAAAAAAJcc/W2ATYBkSOtw/s400/DataBindBulletedListUsingStack.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664169687613881426" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-NorEgt0XG-w/TpsscJLyJAI/AAAAAAAAJco/2s540ljBEAE/s1600/DataBindBulletedListUsingStack1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 351px;" src="http://4.bp.blogspot.com/-NorEgt0XG-w/TpsscJLyJAI/AAAAAAAAJco/2s540ljBEAE/s400/DataBindBulletedListUsingStack1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5664169818361832450" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-checkboxlist-using.html"&gt;How to DataBind CheckBoxList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-dropdownlist-using.html"&gt;How to DataBind DropDownList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/03/how-to-use-theme-and-skin-id-skinid-in_23.html"&gt;How to use theme and skin id (SkinID) in BulletedList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-listbox-using-stack.html"&gt;How to DataBind ListBox using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-radiobuttonlist-using.html"&gt;How to DataBind RadioButtonList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/03/how-to-set-change-radiobutton-forecolor.html"&gt;How to set, change RadioButton ForeColor (text, font color) programmatically&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-stack-to-existing-one.html"&gt;How to copy Stack to an existing one-dimensional Array, starting at the specified array index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/03/how-to-set-change-label-text.html"&gt;How to set, change Label text programmatically&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-peek-method-how-to-get-object-at.html"&gt;Stack Peek() Method - How to get the object at the top of the Stack without removing it&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-pop-method-how-to-remove-and-get.html"&gt;Stack Pop() Method - How to remove and get the object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-4982792426585235209?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4982792426585235209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4982792426585235209'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-databind-bulletedlist-using.html' title='How to DataBind BulletedList using Stack DataSource'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-ZSmAzGy04d4/TpssUiHCvFI/AAAAAAAAJcc/W2ATYBkSOtw/s72-c/DataBindBulletedListUsingStack.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-544364702391365273</id><published>2011-10-15T03:10:00.000-07:00</published><updated>2011-11-30T07:38:03.255-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to initialize a new instance of the Stack class with default initial capacity</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to initialize a new instance of the Stack class with default initial capacity
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     SystemCollectionsStack.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack();
        colors.Push("Red");
        colors.Push("Green");
        colors.Push("Blue");
        colors.Push("Yellow");

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=Crimson&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to initialize a new instance of the Stack class with default initial capacity&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack
            &amp;lt;br /&amp;gt; How to initialize a new instance of the Stack
            &amp;lt;br /&amp;gt; class that is empty and has the default initial capacity
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="525" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DarkOliveGreen"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Stack Constructor"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-cgG5KxUr7a4/TplcQlyo5xI/AAAAAAAAJcE/AInJEBw9bAs/s1600/SystemCollectionsStack.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 237px;" src="http://2.bp.blogspot.com/-cgG5KxUr7a4/TplcQlyo5xI/AAAAAAAAJcE/AInJEBw9bAs/s400/SystemCollectionsStack.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663659446487279378" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-dYdYZh1q8-U/TplcXGFTjkI/AAAAAAAAJcU/tCheLBQUsn8/s1600/SystemCollectionsStack1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 263px;" src="http://3.bp.blogspot.com/-dYdYZh1q8-U/TplcXGFTjkI/AAAAAAAAJcU/tCheLBQUsn8/s400/SystemCollectionsStack1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663659558234721858" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-create-read-only-copy-of.html"&gt;How to create a read-only copy of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-item-property-how-to-get-or.html"&gt;ArrayList Item Property - How to get or set the element at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/10/aspnet-bulletedlist-example-how-to-use.html"&gt;Asp.Net BulletedList example: how to use DisplayMode LinkButton&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-objects-from-stack.html"&gt;How to remove all objects from the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/11/aspnet-sqlcommand-example-how-to-build.html"&gt;asp.net SqlCommand() example: how to build SQL dynamically&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack.html"&gt;How to initialize a new instance of Stack class that contains elements copied from specified collection&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-empty.html"&gt;How to initialize a new instance of empty Stack class with specified initial capacity&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/10/how-to-create-and-use-user-control-in.html"&gt;How to create and use User Control in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-determine-whether-element-is-in.html"&gt;How to determine whether an element is in the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-count-how-to-get-number-of.html"&gt;Stack Count - How to Get the number of elements contained in the Stack&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-544364702391365273?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/544364702391365273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/544364702391365273'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack_15.html' title='How to initialize a new instance of the Stack class with default initial capacity'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-cgG5KxUr7a4/TplcQlyo5xI/AAAAAAAAJcE/AInJEBw9bAs/s72-c/SystemCollectionsStack.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8258098892307272670</id><published>2011-10-15T03:06:00.000-07:00</published><updated>2011-11-30T07:36:26.964-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>Stack Count - How to Get the number of elements contained in the Stack</title><content type='html'>&lt;div class="aspposttitle"&gt;
Stack Count - How to Get the number of elements contained in the Stack
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     StackCountProperty.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack();

        colors.Push("DarkSeaGreen");
        colors.Push("SpringGreen");
        colors.Push("OliveDrab");
        colors.Push("OrangeRed");
        colors.Push("HotPink");

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=OrangeRed&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Total Stack Elements: " + colors.Count;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;Stack Count - How to Get the number of elements contained in the Stack&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack Count Property
            &amp;lt;br /&amp;gt; How to Get the number of elements contained in the Stack
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="575" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="SlateBlue"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Stack Count Property"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-ENZEj_pu9eY/TplbO-Wv9_I/AAAAAAAAJbs/tJeMrj90bEQ/s1600/StackCountProperty.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 240px;" src="http://2.bp.blogspot.com/-ENZEj_pu9eY/TplbO-Wv9_I/AAAAAAAAJbs/tJeMrj90bEQ/s400/StackCountProperty.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663658319209822194" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-8EJ7TDqL89k/TplbVmEgjkI/AAAAAAAAJb4/HtaebE6gXqs/s1600/StackCountProperty1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 273px;" src="http://2.bp.blogspot.com/-8EJ7TDqL89k/TplbVmEgjkI/AAAAAAAAJb4/HtaebE6gXqs/s400/StackCountProperty1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663658432949947970" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-elements-of-arraylist-to.html"&gt;How to copy the elements of the ArrayList to a new array of the specified element type&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-capacity-how-to-get-or-set.html"&gt;ArrayList Capacity - How to get or set number of elements that ArrayList can contain&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/11/aspnet-calendar-how-to-use-calendar.html"&gt;asp.net Calendar: how to use Calendar&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-count-how-to-get-number-of.html"&gt;ArrayList Count - How to get number of elements actually contained in the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/11/how-to-set-radiobuttonlist-borderwidth.html"&gt;How to set RadioButtonList BorderWidth, BorderColor programmatically in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-isfixedsize-property-how-to.html"&gt;ArrayList IsFixedSize Property - How to get whether the ArrayList has a fixed size&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-empty.html"&gt;How to initialize a new instance of empty Stack class with specified initial capacity&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/10/aspnet-checkboxlist-itemsclear-example.html"&gt;asp.net CheckBoxList Items.Clear() example: how to remove all Items from CheckBoxList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-determine-whether-element-is-in.html"&gt;How to determine whether an element is in the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack_15.html"&gt;How to initialize a new instance of the Stack class with default initial capacity&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8258098892307272670?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8258098892307272670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8258098892307272670'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/stack-count-how-to-get-number-of.html' title='Stack Count - How to Get the number of elements contained in the Stack'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-ENZEj_pu9eY/TplbO-Wv9_I/AAAAAAAAJbs/tJeMrj90bEQ/s72-c/StackCountProperty.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-2223294068460642522</id><published>2011-10-15T03:02:00.001-07:00</published><updated>2011-11-30T07:34:34.402-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to determine whether an element is in the Stack</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to determine whether an element is in the Stack
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     StackContainsMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack();

        colors.Push("BurlyWood");
        colors.Push("SaddleBrown");
        colors.Push("SandyBrown");
        colors.Push("Ivory");

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=SlateBlue&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Is Element 'Ivory' Exists In Stack? " + colors.Contains("Ivory");
        Label1.Text += "&amp;lt;br /&amp;gt;Is Element 'Salmon' Exists In Stack? " + colors.Contains("Salmon");
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to determine whether an element is in the Stack&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack Contains() Method
            &amp;lt;br /&amp;gt; How to determine whether an element is in the Stack
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="475" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="SteelBlue"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Stack Contains() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-khryTl8yN8o/TplaQddTa_I/AAAAAAAAJbU/JOxDINwHHLU/s1600/StackContainsMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 247px;" src="http://4.bp.blogspot.com/-khryTl8yN8o/TplaQddTa_I/AAAAAAAAJbU/JOxDINwHHLU/s400/StackContainsMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663657245227052018" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-HiUR0-mar1U/TplaXtpKXAI/AAAAAAAAJbg/IehroLyvC8g/s1600/StackContainsMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 294px;" src="http://4.bp.blogspot.com/-HiUR0-mar1U/TplaXtpKXAI/AAAAAAAAJbg/IehroLyvC8g/s400/StackContainsMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663657369830841346" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-how-to-reverse-order-of.html"&gt;ArrayList - How to reverse the order of the elements in the specified range&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-setrange-how-to-copy-elements.html"&gt;ArrayList SetRange() - How to copy the elements of a collection over a range of elements in the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/03/how-to-remove-list-item-by-item-text-in_2485.html"&gt;How to remove list item by item text in RadioButtonList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-sort-elements-in-entire.html"&gt;How to sort the elements in the entire ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/12/aspnet-gridview-how-to-use.html"&gt;asp.net GridView: how to use&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-toarray-how-to-copy-elements.html"&gt;ArrayList ToArray() - How to copy the elements of the ArrayList to a new Object array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-empty.html"&gt;How to initialize a new instance of empty Stack class with specified initial capacity&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/12/aspnet-dropdownlist-how-to-add-list.html"&gt;asp.net DropDownList: how to add list item programmatically&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-count-how-to-get-number-of.html"&gt;Stack Count - How to Get the number of elements contained in the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack_15.html"&gt;How to initialize a new instance of the Stack class with default initial capacity&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-2223294068460642522?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/2223294068460642522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/2223294068460642522'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-determine-whether-element-is-in.html' title='How to determine whether an element is in the Stack'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-khryTl8yN8o/TplaQddTa_I/AAAAAAAAJbU/JOxDINwHHLU/s72-c/StackContainsMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-4785442459291227768</id><published>2011-10-15T02:57:00.000-07:00</published><updated>2011-11-30T07:32:54.904-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to initialize a new instance of empty Stack class with specified initial capacity</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to initialize a new instance of empty Stack class with specified initial capacity
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     StackConstructorInt32.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack(100);

        Label1.Text = "Stack initialized with initial capacity 100";

        colors.Push("Ivory");
        colors.Push("IndianRed");
        colors.Push("DarkGreen");
        colors.Push("ForestGreen");

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Stack Elements... ";
        Label1.Text += "&amp;lt;font color=DeepPink&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to initialize a new instance of empty Stack class with specified initial capacity&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack Stack Constructor (Int32)
            &amp;lt;br /&amp;gt; How to initialize a new instance of Stack class
            &amp;lt;br /&amp;gt; that is empty and has specified initial capacity or
            &amp;lt;br /&amp;gt; the default initial capacity, whichever is greater
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="475" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DarkOrchid"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Stack Constructor (Int32)"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-VvR9ZMnhqkg/TplZPQKmSiI/AAAAAAAAJa8/SQTuHGVRCLw/s1600/StackConstructorInt32.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 249px;" src="http://3.bp.blogspot.com/-VvR9ZMnhqkg/TplZPQKmSiI/AAAAAAAAJa8/SQTuHGVRCLw/s400/StackConstructorInt32.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663656124967438882" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-Ux-00bN5MaM/TplZXoQMh6I/AAAAAAAAJbI/MOZDQOKBqsc/s1600/StackConstructorInt32-1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 328px;" src="http://2.bp.blogspot.com/-Ux-00bN5MaM/TplZXoQMh6I/AAAAAAAAJbI/MOZDQOKBqsc/s400/StackConstructorInt32-1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663656268872320930" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-use-systemcollectionsarraylist.html"&gt;How to use System.Collections.ArrayList IndexOf(Object, Int32, Int32) Method&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-insert-element-into-arraylist-at.html"&gt;How to insert an element into the ArrayList at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/03/how-to-data-bind-checkboxlist-on-page.html"&gt;How to data bind CheckBoxList on page load&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-insert-elements-of-collection.html"&gt;How to insert the elements of a collection into the ArrayList at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-lastindexof-how-to-search.html"&gt;ArrayList LastIndexOf() - How to search specified Object and get index of last occurrence&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/03/how-to-use-autopostback-feature-in.html"&gt;How to use AutoPostBack feature in CheckBoxList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-determine-whether-element-is-in.html"&gt;How to determine whether an element is in the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/03/how-to-remove-list-item-by-item-text-in_1309.html"&gt;How to remove list item by item text in ListBox&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-count-how-to-get-number-of.html"&gt;Stack Count - How to Get the number of elements contained in the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack_15.html"&gt;How to initialize a new instance of the Stack class with default initial capacity&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-4785442459291227768?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4785442459291227768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4785442459291227768'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-empty.html' title='How to initialize a new instance of empty Stack class with specified initial capacity'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-VvR9ZMnhqkg/TplZPQKmSiI/AAAAAAAAJa8/SQTuHGVRCLw/s72-c/StackConstructorInt32.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-7645014917012310459</id><published>2011-10-15T00:28:00.001-07:00</published><updated>2011-11-30T07:31:00.959-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to initialize a new instance of Stack class that contains elements copied from specified collection</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to initialize a new instance of Stack class that contains elements copied from specified collection
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     StackConstructorICollection.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        List&amp;lt;string&amp;gt; redColors = new List&amp;lt;string&amp;gt;() {"Red","IndianRed","DarkRed" };
        Stack colors = new Stack(redColors);

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=Crimson&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
        
        colors.Push("Yellow");

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Push 'Yellow', Now Stack Elements... ";
        Label1.Text += "&amp;lt;font color=Crimson&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to initialize a new instance of Stack class that contains elements copied from specified collection&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack Stack Constructor (ICollection)
            &amp;lt;br /&amp;gt; How to initialize a new instance of the Stack class
            &amp;lt;br /&amp;gt; that contains elements copied from the specified collection
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="575" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DarkGreen"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Stack Constructor (ICollection)"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-ALHK1-LsIWc/Tpk2JyOtG5I/AAAAAAAAJak/u4TaTTyFywg/s1600/StackConstructorICollection.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 243px;" src="http://4.bp.blogspot.com/-ALHK1-LsIWc/Tpk2JyOtG5I/AAAAAAAAJak/u4TaTTyFywg/s400/StackConstructorICollection.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663617548125281170" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-YZN9LyhtPyo/Tpk2RRw3ouI/AAAAAAAAJaw/FS9lEIku-A8/s1600/StackConstructorICollection1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 310px;" src="http://4.bp.blogspot.com/-YZN9LyhtPyo/Tpk2RRw3ouI/AAAAAAAAJaw/FS9lEIku-A8/s400/StackConstructorICollection1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663617676849160930" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-arraylist-to-compatible.html"&gt;How to copy ArrayList to a compatible Array, starting at the specified index of the array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-get-arraylist-which-represents.html"&gt;How to get an ArrayList which represents a subset of the elements in the source ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/03/how-to-change-checkbox-border-style.html"&gt;How to change CheckBox border style programmatically&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-search-specified-object-and-get.html"&gt;How to search specified Object and get zero-based index of the first occurrence within the entire ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/03/how-to-clear-list-items-in-listbox.html"&gt;How to clear list items in ListBox (remove all items)&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-search-specified-object-get-zero.html"&gt;How to search specified Object, get zero-based index of first occurrence within the range of elements in ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-create-read-only-copy-of.html"&gt;How to create a read-only copy of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/03/how-to-use-dropdownlist-autopostback.html"&gt;How to use DropDownList AutoPostBack feature&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-item-property-how-to-get-or.html"&gt;ArrayList Item Property - How to get or set the element at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-objects-from-stack.html"&gt;How to remove all objects from the Stack&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-7645014917012310459?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/7645014917012310459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/7645014917012310459'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack.html' title='How to initialize a new instance of Stack class that contains elements copied from specified collection'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-ALHK1-LsIWc/Tpk2JyOtG5I/AAAAAAAAJak/u4TaTTyFywg/s72-c/StackConstructorICollection.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-1151122267140654590</id><published>2011-10-15T00:22:00.000-07:00</published><updated>2011-11-30T07:29:16.273-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to remove all objects from the Stack</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to remove all objects from the Stack
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     StackClearMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Stack colors = new Stack();

        colors.Push("Magenta");
        colors.Push("Maroon");
        colors.Push("MediumSeaGreen");
        colors.Push("Lavender");

        Label1.Text = "Stack Elements... ";
        Label1.Text += "&amp;lt;font color=Tomato&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        //this line remove all elements from Stack.
        colors.Clear();

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call Clear() Method, Stack Elements... ";
        Label1.Text += "&amp;lt;font color=Tomato&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to remove all objects from the Stack&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.Stack Clear() Method
            &amp;lt;br /&amp;gt; How to remove all objects from the Stack
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="375" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="SteelBlue"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test Stack Clear() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-YM5L7N5x7mc/Tpk1DlGQTII/AAAAAAAAJaM/S7ERUAuxPoE/s1600/StackClearMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 259px;" src="http://2.bp.blogspot.com/-YM5L7N5x7mc/Tpk1DlGQTII/AAAAAAAAJaM/S7ERUAuxPoE/s400/StackClearMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663616342009334914" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-T9GW-oKsW0M/Tpk1KoKX8eI/AAAAAAAAJaY/0HIrx6PSrok/s1600/StackClearMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 279px;" src="http://1.bp.blogspot.com/-T9GW-oKsW0M/Tpk1KoKX8eI/AAAAAAAAJaY/0HIrx6PSrok/s400/StackClearMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663616463091003874" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-elements-from.html"&gt;How to remove all elements from the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-determine-whether-element-exists.html"&gt;How to determine whether an element exists in ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/02/aspnet-regularexpressionvalidator_7607.html"&gt;asp.net RegularExpressionValidator example: how to validate U.S. Zip Code&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-copyto-how-to-copy-entire.html"&gt;ArrayList CopyTo() - How to copy the entire ArrayList to a compatible one-dimensional Array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-range-of-elements-from.html"&gt;How to copy a range of elements from the ArrayList to a compatible Array, starting at the specified index of the array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/02/how-to-delete-profile-in-aspnet.html"&gt;How to delete profile in asp.net (ProfileManager.DeleteProfile)&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-create-read-only-copy-of.html"&gt;How to create a read-only copy of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/02/how-to-use-themes-and-skins-in-aspnet.html"&gt;How to use themes and skins in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-item-property-how-to-get-or.html"&gt;ArrayList Item Property - How to get or set the element at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack.html"&gt;How to initialize a new instance of Stack class that contains elements copied from specified collection&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-1151122267140654590?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1151122267140654590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1151122267140654590'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-objects-from-stack.html' title='How to remove all objects from the Stack'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-YM5L7N5x7mc/Tpk1DlGQTII/AAAAAAAAJaM/S7ERUAuxPoE/s72-c/StackClearMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-3230022535690400419</id><published>2011-10-15T00:16:00.000-07:00</published><updated>2011-11-30T07:27:45.627-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>ArrayList Item Property - How to get or set the element at the specified index</title><content type='html'>&lt;div class="aspposttitle"&gt;
ArrayList Item Property - How to get or set the element at the specified index
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListItemProperty.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() { "Olive", "Indigo", "Violet", "Green", "Yellow" };

        Label1.Text = "&amp;lt;font color=Crimson&amp;gt;'colors' ArrayList Elements... ";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;ArrayList Index 0 Element: " + colors[0];
        Label1.Text += "&amp;lt;br /&amp;gt;ArrayList Index 2 Element: " + colors[2];
        Label1.Text += "&amp;lt;br /&amp;gt;ArrayList Index 4 Element: " + colors[4];

        colors[2] = "Red";

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;font color=Crimson&amp;gt;After Modify ArrayList Index 2 Element... ";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;ArrayList Item Property - How to get or set the element at the specified index&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList Item Property
            &amp;lt;br /&amp;gt; How to get or set the element at the specified index
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="525" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DarkOliveGreen"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList Item Property"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-BoiYbEPVACM/TpkzfR8mfvI/AAAAAAAAJZ0/DE7tVTbM2SQ/s1600/ArrayListItemProperty.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 254px;" src="http://3.bp.blogspot.com/-BoiYbEPVACM/TpkzfR8mfvI/AAAAAAAAJZ0/DE7tVTbM2SQ/s400/ArrayListItemProperty.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663614618881654514" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-MWmwL2coayY/Tpkzm2JR7BI/AAAAAAAAJaA/dV-GwKNcY4A/s1600/ArrayListItemProperty1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 369px; height: 400px;" src="http://4.bp.blogspot.com/-MWmwL2coayY/Tpkzm2JR7BI/AAAAAAAAJaA/dV-GwKNcY4A/s400/ArrayListItemProperty1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663614748857592850" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-radiobuttonlist-with_09.html"&gt;How to DataBind RadioButtonList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-create-and-use-arraylist.html"&gt;How to create and use ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/01/how-to-add-specific-character-at-end.html"&gt;How to add specific character at the end (right) position of a string in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-add-object-to-end-of-arraylist.html"&gt;How to add an object to the end of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-addrange-how-to-add-elements.html"&gt;ArrayList AddRange() - How to add the elements of an ICollection to the end of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/01/how-to-create-string-array-in-aspnet.html"&gt;How to create a string array in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-create-read-only-copy-of.html"&gt;How to create a read-only copy of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/01/how-to-get-output-of-two-dimension-int.html"&gt;How to get output of a two dimension int array in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-objects-from-stack.html"&gt;How to remove all objects from the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack.html"&gt;How to initialize a new instance of Stack class that contains elements copied from specified collection&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-3230022535690400419?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3230022535690400419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3230022535690400419'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/arraylist-item-property-how-to-get-or.html' title='ArrayList Item Property - How to get or set the element at the specified index'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-BoiYbEPVACM/TpkzfR8mfvI/AAAAAAAAJZ0/DE7tVTbM2SQ/s72-c/ArrayListItemProperty.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-4243855923799893560</id><published>2011-10-15T00:12:00.000-07:00</published><updated>2011-11-30T07:26:15.035-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to create a read-only copy of the ArrayList</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to create a read-only copy of the ArrayList
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListIsReadOnlyProperty.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() { "Salmon", "SandyBrown", "Gray" };

        Label1.Text = "&amp;lt;font color=DodgerBlue&amp;gt;'colors' ArrayList Elements... ";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        ArrayList readOnlyColors = ArrayList.ReadOnly(colors);

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Is 'colors' ArrayList ReadOnly? " + colors.IsReadOnly.ToString();
        Label1.Text += "&amp;lt;br /&amp;gt;Is 'readOnlyColors' ArrayList ReadOnly? " + readOnlyColors.IsReadOnly.ToString();

        colors.Add("White");

        //Uncomment this line to get error message.
        //readOnlyColors.Add("White");

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;font color=DodgerBlue&amp;gt;After Adding 'White', Now 'colors' ArrayList Elements... ";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to create a read-only copy of the ArrayList&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList IsReadOnly Property
            &amp;lt;br /&amp;gt; How to create a read-only copy of the ArrayList
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="525" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="HotPink"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList IsReadOnly Property"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-UUWtv2cID3M/TpkycoF-4lI/AAAAAAAAJZc/Ev3sS2M3t04/s1600/ArrayListIsReadOnlyProperty.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 238px;" src="http://4.bp.blogspot.com/-UUWtv2cID3M/TpkycoF-4lI/AAAAAAAAJZc/Ev3sS2M3t04/s400/ArrayListIsReadOnlyProperty.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663613473775346258" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-AkWaddPw-jI/Tpkyk933m2I/AAAAAAAAJZo/2z4UnyGFQcc/s1600/ArrayListIsReadOnlyProperty1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 328px;" src="http://2.bp.blogspot.com/-AkWaddPw-jI/Tpkyk933m2I/AAAAAAAAJZo/2z4UnyGFQcc/s400/ArrayListIsReadOnlyProperty1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663613617060682594" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-bulletedlist-with_09.html"&gt;How to DataBind BulletedList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-checkboxlist-with_09.html"&gt;How to DataBind CheckBoxList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/01/how-to-get-file-last-write-time-utc.html"&gt;How to get file last write time (Utc) programmatically in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-dropdownlist-with_09.html"&gt;How to DataBind DropDownList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-listbox-with-generic.html"&gt;How to DataBind ListBox with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/01/aspnet-date-time-example-how-to-add_3758.html"&gt;asp.net date time example: how to add years (DateTime.Now.AddYears())&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-item-property-how-to-get-or.html"&gt;ArrayList Item Property - How to get or set the element at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/01/aspnet-date-time-example-how-to-get-day_112.html"&gt;asp.net date time example: how to get the day of year from date time object in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-objects-from-stack.html"&gt;How to remove all objects from the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack.html"&gt;How to initialize a new instance of Stack class that contains elements copied from specified collection&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-4243855923799893560?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4243855923799893560'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4243855923799893560'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-create-read-only-copy-of.html' title='How to create a read-only copy of the ArrayList'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-UUWtv2cID3M/TpkycoF-4lI/AAAAAAAAJZc/Ev3sS2M3t04/s72-c/ArrayListIsReadOnlyProperty.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-2853524576774665456</id><published>2011-10-15T00:07:00.000-07:00</published><updated>2011-11-30T07:24:41.964-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>ArrayList IsFixedSize Property - How to get whether the ArrayList has a fixed size</title><content type='html'>&lt;div class="aspposttitle"&gt;
ArrayList IsFixedSize Property - How to get whether the ArrayList has a fixed size
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListIsFixedSizeProperty.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() { "Blue", "SkyBlue", "LightBlue" };

        Label1.Text = "&amp;lt;font color=DodgerBlue&amp;gt;'colors' ArrayList Elements... ";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        ArrayList fixedSizeColors = ArrayList.FixedSize(colors);

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Is 'colors' ArrayList FixedSize? " + colors.IsFixedSize.ToString();
        Label1.Text += "&amp;lt;br /&amp;gt;Is 'fixedSizeColors' ArrayList FixedSize? " + fixedSizeColors.IsFixedSize.ToString();

        colors.Add("Green");
        
        //Uncomment this line to get error message, because fixed size ArrayList does not support add/remove
        //fixedSizeColors.Add("Green");
        
        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;font color=DodgerBlue&amp;gt;After Adding 'Green', Now 'colors' ArrayList Elements... ";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        fixedSizeColors[1] = "Crimson";
        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After modify 'index 1', Now 'fixedSizeColors' ArrayList Elements... &amp;lt;font color=DodgerBlue&amp;gt;";
        foreach (string color in fixedSizeColors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;ArrayList IsFixedSize Property - How to get whether the ArrayList has a fixed size&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList IsFixedSize Property
            &amp;lt;br /&amp;gt; How to get a value indicating whether
            &amp;lt;br /&amp;gt; the ArrayList has a fixed size
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="325" align="left" color="Navy" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="HotPink"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList IsFixedSize Property"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-qNBuHWRP6Pc/TpkxRgq3_qI/AAAAAAAAJZE/RM0m9aBN7b8/s1600/ArrayListIsFixedSizeProperty.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 252px;" src="http://1.bp.blogspot.com/-qNBuHWRP6Pc/TpkxRgq3_qI/AAAAAAAAJZE/RM0m9aBN7b8/s400/ArrayListIsFixedSizeProperty.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663612183292411554" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-KPTHkKEfFB0/TpkxZSI8OXI/AAAAAAAAJZQ/UORS86VoDM0/s1600/ArrayListIsFixedSizeProperty1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 333px;" src="http://1.bp.blogspot.com/-KPTHkKEfFB0/TpkxZSI8OXI/AAAAAAAAJZQ/UORS86VoDM0/s400/ArrayListIsFixedSizeProperty1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663612316830939506" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-radiobuttonlist-with_09.html"&gt;How to DataBind RadioButtonList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-create-and-use-arraylist.html"&gt;How to create and use ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/01/aspnet-urlencode-method-example-how-to.html"&gt;asp.net UrlEncode method example: how to encode an url in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-elements-from.html"&gt;How to remove all elements from the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-determine-whether-element-exists.html"&gt;How to determine whether an element exists in ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/01/aspnet-viewstate-example-how-to-read.html"&gt;asp.net ViewState example: how to read data from ViewState&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-elements-of-arraylist-to.html"&gt;How to copy the elements of the ArrayList to a new array of the specified element type&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/01/how-to-get-physical-application-path.html"&gt;How to get the physical application path programmatically in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-capacity-how-to-get-or-set.html"&gt;ArrayList Capacity - How to get or set number of elements that ArrayList can contain&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-count-how-to-get-number-of.html"&gt;ArrayList Count - How to get number of elements actually contained in the ArrayList&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-2853524576774665456?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/2853524576774665456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/2853524576774665456'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/arraylist-isfixedsize-property-how-to.html' title='ArrayList IsFixedSize Property - How to get whether the ArrayList has a fixed size'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-qNBuHWRP6Pc/TpkxRgq3_qI/AAAAAAAAJZE/RM0m9aBN7b8/s72-c/ArrayListIsFixedSizeProperty.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-2156931497082755567</id><published>2011-10-15T00:02:00.000-07:00</published><updated>2011-11-30T07:22:24.022-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>ArrayList Count - How to get number of elements actually contained in the ArrayList</title><content type='html'>&lt;div class="aspposttitle"&gt;
ArrayList Count - How to get number of elements actually contained in the ArrayList
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListCountProperty.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() { "IndianRed","Red","DarkRed" };

        Label1.Text = "&amp;lt;font color=DodgerBlue&amp;gt;ArrayList Elements... ";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        Label1.Text += "&amp;lt;br /&amp;gt;ArrayList Elements Count: " + colors.Count;
        
        colors.Add("DodgerBlue");

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;font color=DodgerBlue&amp;gt;After Adding 'DodgerBlue' ArrayList Elements... ";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        Label1.Text += "&amp;lt;br /&amp;gt;ArrayList Elements Count: " + colors.Count;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;ArrayList Count - How to get number of elements actually contained in the ArrayList&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList Count Property
            &amp;lt;br /&amp;gt; How to get the number of elements
            &amp;lt;br /&amp;gt; actually contained in the ArrayList
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="375" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="HotPink"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList Count Property"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-J4tGdOfIoAI/TpkwK318wXI/AAAAAAAAJYs/CUuGbuXC4Js/s1600/ArrayListCountProperty.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 252px;" src="http://3.bp.blogspot.com/-J4tGdOfIoAI/TpkwK318wXI/AAAAAAAAJYs/CUuGbuXC4Js/s400/ArrayListCountProperty.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663610969742164338" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-e1MeudZHJWI/TpkwT6FB-GI/AAAAAAAAJY4/tcT9NaLxvUc/s1600/ArrayListCountProperty1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 390px;" src="http://4.bp.blogspot.com/-e1MeudZHJWI/TpkwT6FB-GI/AAAAAAAAJY4/tcT9NaLxvUc/s400/ArrayListCountProperty1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663611124961114210" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-arraylist-to-compatible.html"&gt;How to copy ArrayList to a compatible Array, starting at the specified index of the array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-get-arraylist-which-represents.html"&gt;How to get an ArrayList which represents a subset of the elements in the source ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/12/aspnet-objectdatasource-example_3995.html"&gt;asp.net ObjectDataSource example: populate DetailsView&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-use-systemcollectionsarraylist.html"&gt;How to use System.Collections.ArrayList IndexOf(Object, Int32, Int32) Method&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-insert-element-into-arraylist-at.html"&gt;How to insert an element into the ArrayList at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/12/aspnet-gridview-example-sample-simple.html"&gt;asp.net GridView example: a sample simple Master-Details page&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-elements-of-arraylist-to.html"&gt;How to copy the elements of the ArrayList to a new array of the specified element type&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2009/01/aspnet-querystring-example-how-to-use.html"&gt;asp.net QueryString example: how to use QueryString&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-capacity-how-to-get-or-set.html"&gt;ArrayList Capacity - How to get or set number of elements that ArrayList can contain&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-isfixedsize-property-how-to.html"&gt;ArrayList IsFixedSize Property - How to get whether the ArrayList has a fixed size&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-2156931497082755567?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/2156931497082755567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/2156931497082755567'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/arraylist-count-how-to-get-number-of.html' title='ArrayList Count - How to get number of elements actually contained in the ArrayList'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-J4tGdOfIoAI/TpkwK318wXI/AAAAAAAAJYs/CUuGbuXC4Js/s72-c/ArrayListCountProperty.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-5416257195733730282</id><published>2011-10-14T23:56:00.000-07:00</published><updated>2011-11-30T07:20:03.915-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>ArrayList Capacity - How to get or set number of elements that ArrayList can contain</title><content type='html'>&lt;div class="aspposttitle"&gt;
ArrayList Capacity - How to get or set number of elements that ArrayList can contain
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListCapacityProperty.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() { "Snow","Indigo","FloralWhite","Gold","Red","Green" };

        Label1.Text = "ArrayList Capacity: " + colors.Capacity;

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;font color=DodgerBlue&amp;gt;ArrayList Elements... ";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        colors.Capacity = 25;

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Now ArrayList Capacity: " + colors.Capacity;
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;ArrayList Capacity - How to get or set number of elements that ArrayList can contain&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList Capacity Property
            &amp;lt;br /&amp;gt; How to get or set the number
            &amp;lt;br /&amp;gt; of elements that the ArrayList can contain
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="450" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DeepPink"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList Capacity Property"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-0yfW6O9zAgM/TpkuxH071XI/AAAAAAAAJYU/OjylucM8TdI/s1600/ArrayListCapacityProperty.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 266px;" src="http://3.bp.blogspot.com/-0yfW6O9zAgM/TpkuxH071XI/AAAAAAAAJYU/OjylucM8TdI/s400/ArrayListCapacityProperty.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663609427844650354" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-Ja3c3OcQn0c/Tpku6dQITUI/AAAAAAAAJYg/9ofAEoI0AzA/s1600/ArrayListCapacityProperty1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 388px;" src="http://1.bp.blogspot.com/-Ja3c3OcQn0c/Tpku6dQITUI/AAAAAAAAJYg/9ofAEoI0AzA/s400/ArrayListCapacityProperty1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5663609588214680898" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-element-at-specified.html"&gt;How to remove the element at the specified index of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-first-occurrence-of.html"&gt;How to remove first occurrence of a specific object from ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/11/aspnet-substitution-control-example-how.html"&gt;asp.net Substitution control example: how to use OutputCache directive with Substitution&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-how-to-reverse-order-of.html"&gt;ArrayList - How to reverse the order of the elements in the specified range&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-setrange-how-to-copy-elements.html"&gt;ArrayList SetRange() - How to copy the elements of a collection over a range of elements in the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/11/aspnet-gridview-checkboxfield-example.html"&gt;asp.net GridView CheckBoxField example: how to use asp:CheckBoxField&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-elements-of-arraylist-to.html"&gt;How to copy the elements of the ArrayList to a new array of the specified element type&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/11/aspnet-sqldatasource-gridview-example.html"&gt;asp.net SqlDataSource, GridView example: how to populate programmatically&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-count-how-to-get-number-of.html"&gt;ArrayList Count - How to get number of elements actually contained in the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-isfixedsize-property-how-to.html"&gt;ArrayList IsFixedSize Property - How to get whether the ArrayList has a fixed size&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-5416257195733730282?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5416257195733730282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/5416257195733730282'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/arraylist-capacity-how-to-get-or-set.html' title='ArrayList Capacity - How to get or set number of elements that ArrayList can contain'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-0yfW6O9zAgM/TpkuxH071XI/AAAAAAAAJYU/OjylucM8TdI/s72-c/ArrayListCapacityProperty.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8761535515334401181</id><published>2011-10-12T04:11:00.000-07:00</published><updated>2011-11-30T07:16:55.564-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to copy the elements of the ArrayList to a new array of the specified element type</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to copy the elements of the ArrayList to a new array of the specified element type
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListToArrayMethodWithType.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList favoriteColors = new ArrayList() { "White","FloralWhite","FireBrick","GoldenRod","LightCyan" };

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=DodgerBlue&amp;gt;";
        foreach (string color in favoriteColors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        string[] favoriteColorArray = (string[])favoriteColors.ToArray(typeof(string));

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call ToArray(Type string) Method";
        Label1.Text += "&amp;lt;br /&amp;gt;Array Elements....";
        Label1.Text += "&amp;lt;font color=MediumSlateBlue&amp;gt;";
        for (int i = 0; i &amp;lt; favoriteColorArray.Length; i++)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + favoriteColorArray[i];
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to copy the elements of the ArrayList to a new array of the specified element type&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList ToArray(Type) Method
            &amp;lt;br /&amp;gt; How to copy the elements of the ArrayList
            &amp;lt;br /&amp;gt; to a new array of the specified element type
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="450" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DeepPink"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList ToArray(Type) Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-4NjsbBSvGik/TpV1_RMEURI/AAAAAAAAJX8/rBezm5x1uCk/s1600/ArrayListToArrayMethodWithType.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 274px;" src="http://1.bp.blogspot.com/-4NjsbBSvGik/TpV1_RMEURI/AAAAAAAAJX8/rBezm5x1uCk/s400/ArrayListToArrayMethodWithType.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662561836294492434" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-slu0oS8X72Q/TpV2GRUch6I/AAAAAAAAJYI/Nqr4UWraPXY/s1600/ArrayListToArrayMethodWithType1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 398px; height: 400px;" src="http://1.bp.blogspot.com/-slu0oS8X72Q/TpV2GRUch6I/AAAAAAAAJYI/Nqr4UWraPXY/s400/ArrayListToArrayMethodWithType1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662561956588717986" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-capacity-how-to-get-or-set.html"&gt;ArrayList Capacity - How to get or set number of elements that ArrayList can contain&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-count-how-to-get-number-of.html"&gt;ArrayList Count - How to get number of elements actually contained in the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/10/fileinfo-class-example-how-to-get-file_12.html"&gt;FileInfo class example: how to get file Length in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-isfixedsize-property-how-to.html"&gt;ArrayList IsFixedSize Property - How to get whether the ArrayList has a fixed size&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-peek-method-how-to-get-object-at.html"&gt;Stack Peek() Method - How to get the object at the top of the Stack without removing it&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/10/login-example-how-to-login-users.html"&gt;Login Example: how to login users programmatically in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-pop-method-how-to-remove-and-get.html"&gt;Stack Pop() Method - How to remove and get the object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/10/aspnet-treeview-example-programmaticaly.html"&gt;Asp.Net TreeView Example: programmatically ShowCheckBoxes All, None, Leaf, Parent, Root&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-push-method-how-to-insert-object.html"&gt;Stack Push() Method - How to insert an object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-toarray-method-how-to-copy-stack.html"&gt;Stack ToArray() Method - How to copy the Stack to a new array&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8761535515334401181?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8761535515334401181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8761535515334401181'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-copy-elements-of-arraylist-to.html' title='How to copy the elements of the ArrayList to a new array of the specified element type'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-4NjsbBSvGik/TpV1_RMEURI/AAAAAAAAJX8/rBezm5x1uCk/s72-c/ArrayListToArrayMethodWithType.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-4471043435447711197</id><published>2011-10-12T04:07:00.001-07:00</published><updated>2011-11-30T07:14:48.616-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>ArrayList ToArray() - How to copy the elements of the ArrayList to a new Object array</title><content type='html'>&lt;div class="aspposttitle"&gt;
ArrayList ToArray() - How to copy the elements of the ArrayList to a new Object array
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListToArrayMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() { "CornFlowerBlue", "DarkGoldenRod", "Gold", "DodgerBlue", "FloralWhite" };

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=DarkOrange&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        var colorArray = colors.ToArray();

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call ToArray() Method";
        Label1.Text += "&amp;lt;br /&amp;gt;Array Elements....";
        Label1.Text += "&amp;lt;font color=DarkSalmon&amp;gt;";
        for (int i = 0; i &amp;lt; colorArray.Length; i++)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + colorArray[i].ToString();
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;ArrayList ToArray() - How to copy the elements of the ArrayList to a new Object array&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList ToArray() Method
            &amp;lt;br /&amp;gt; How to copy the elements of the ArrayList to a new Object array
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="650" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="SeaGreen"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList ToArray() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-amo1GnLbESM/TpV0-Ood1HI/AAAAAAAAJXk/VjC83gvZ2WQ/s1600/ArrayListToArrayMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 283px;" src="http://1.bp.blogspot.com/-amo1GnLbESM/TpV0-Ood1HI/AAAAAAAAJXk/VjC83gvZ2WQ/s400/ArrayListToArrayMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662560718916801650" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-jSriLl4zzGM/TpV1FZhh-lI/AAAAAAAAJXw/7RlyNMgk5L8/s1600/ArrayListToArrayMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 318px;" src="http://2.bp.blogspot.com/-jSriLl4zzGM/TpV1FZhh-lI/AAAAAAAAJXw/7RlyNMgk5L8/s400/ArrayListToArrayMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662560842099587666" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-how-to-reverse-order-of.html"&gt;ArrayList - How to reverse the order of the elements in the specified range&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-setrange-how-to-copy-elements.html"&gt;ArrayList SetRange() - How to copy the elements of a collection over a range of elements in the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/10/radiobuttonlist-example-how-to-use.html"&gt;RadioButtonList example: how to use RadioButtonList control in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-sort-elements-in-entire.html"&gt;How to sort the elements in the entire ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-count-how-to-get-number-of.html"&gt;Stack Count - How to Get the number of elements contained in the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/10/sitemappath-example-how-to-use.html"&gt;SiteMapPath example: how to use SiteMapPath control in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack_15.html"&gt;How to initialize a new instance of the Stack class with default initial capacity&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/10/comparevalidator-example-how-to-use.html"&gt;CompareValidator example: how to use CompareValidator control in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-dropdownlist-using.html"&gt;How to DataBind DropDownList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-listbox-using-stack.html"&gt;How to DataBind ListBox using Stack DataSource&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-4471043435447711197?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4471043435447711197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4471043435447711197'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/arraylist-toarray-how-to-copy-elements.html' title='ArrayList ToArray() - How to copy the elements of the ArrayList to a new Object array'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-amo1GnLbESM/TpV0-Ood1HI/AAAAAAAAJXk/VjC83gvZ2WQ/s72-c/ArrayListToArrayMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-3511746367236571864</id><published>2011-10-12T04:02:00.000-07:00</published><updated>2011-11-30T07:10:04.334-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to sort the elements in the entire ArrayList</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to sort the elements in the entire ArrayList
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListSortMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() { "LavenderBlush", "GreenYellow", "OliveDrab", "Coral", "Indigo","Cyan" };

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=DeepPink&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        colors.Sort();

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call Sort() Method";
        Label1.Text += "&amp;lt;br /&amp;gt;Now ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=HotPink&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to sort the elements in the entire ArrayList&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList Sort() Method
            &amp;lt;br /&amp;gt; How to sort the elements in the entire ArrayList
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="450" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="SeaGreen"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList Sort() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-5SQzWhS-354/TpVz3JXJhPI/AAAAAAAAJXM/S6ROQ1zTo4E/s1600/ArrayListSortMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 263px;" src="http://1.bp.blogspot.com/-5SQzWhS-354/TpVz3JXJhPI/AAAAAAAAJXM/S6ROQ1zTo4E/s400/ArrayListSortMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662559497731278066" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-xa4Wrb0eHSw/TpV0AY4d4WI/AAAAAAAAJXY/qKFhZvGWgi8/s1600/ArrayListSortMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 362px; height: 400px;" src="http://2.bp.blogspot.com/-xa4Wrb0eHSw/TpV0AY4d4WI/AAAAAAAAJXY/qKFhZvGWgi8/s400/ArrayListSortMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662559656516378978" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-how-to-reverse-order-of.html"&gt;ArrayList - How to reverse the order of the elements in the specified range&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-setrange-how-to-copy-elements.html"&gt;ArrayList SetRange() - How to copy the elements of a collection over a range of elements in the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/10/sqlparameter-example-how-to-use.html"&gt;SqlParameter example: how to use SqlParameter in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-toarray-how-to-copy-elements.html"&gt;ArrayList ToArray() - How to copy the elements of the ArrayList to a new Object array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-count-how-to-get-number-of.html"&gt;ArrayList Count - How to get number of elements actually contained in the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/10/fileupload-example-how-to-use.html"&gt;FileUpload example: how to use FileUpload control in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-isfixedsize-property-how-to.html"&gt;ArrayList IsFixedSize Property - How to get whether the ArrayList has a fixed size&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2008/10/listbox-example-how-to-validate-listbox.html"&gt;ListBox example: how to validate ListBox control in asp.net&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-objects-from-stack.html"&gt;How to remove all objects from the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack.html"&gt;How to initialize a new instance of Stack class that contains elements copied from specified collection&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-3511746367236571864?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3511746367236571864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3511746367236571864'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-sort-elements-in-entire.html' title='How to sort the elements in the entire ArrayList'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-5SQzWhS-354/TpVz3JXJhPI/AAAAAAAAJXM/S6ROQ1zTo4E/s72-c/ArrayListSortMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8918522310860265624</id><published>2011-10-12T03:56:00.000-07:00</published><updated>2011-11-29T07:13:03.546-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>ArrayList SetRange() - How to copy the elements of a collection over a range of elements in the ArrayList</title><content type='html'>&lt;div class="aspposttitle"&gt;
ArrayList SetRange() - How to copy the elements of a collection over a range of elements in the ArrayList
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListSetRangeMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() { "Red", "IndianRed", "PaleVioletRed", "DarkRed", "Lavender","Snow" };

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=SeaGreen&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        List&amp;lt;string&amp;gt; pinkColors = new List&amp;lt;string&amp;gt;() {"Pink","DeepPnk","HotPink" };
        colors.SetRange(2,pinkColors);

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;List Elements(ICollection)....";
        Label1.Text += "&amp;lt;font color=SlateBlue&amp;gt;";
        foreach (string color in pinkColors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call SetRange(index 2, ICollection) Method";
        Label1.Text += "&amp;lt;br /&amp;gt;Now ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=DeepPink&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;ArrayList SetRange() - How to copy the elements of a collection over a range of elements in the ArrayList&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList SetRange() Method
            &amp;lt;br /&amp;gt; How to copy the elements of a collection
            &amp;lt;br /&amp;gt; over a range of elements in the ArrayList
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="425" align="left" color="Navy" /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DarkSalmon"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList SetRange() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-wRYXlfyADFY/TpVyl7vGGpI/AAAAAAAAJW0/ES7Wzevqxus/s1600/ArrayListSetRangeMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 282px;" src="http://1.bp.blogspot.com/-wRYXlfyADFY/TpVyl7vGGpI/AAAAAAAAJW0/ES7Wzevqxus/s400/ArrayListSetRangeMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662558102504217234" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-2ztsit8g_s0/TpVyuPAFbZI/AAAAAAAAJXA/mh5eKRQFWSc/s1600/ArrayListSetRangeMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 345px; height: 400px;" src="http://1.bp.blogspot.com/-2ztsit8g_s0/TpVyuPAFbZI/AAAAAAAAJXA/mh5eKRQFWSc/s400/ArrayListSetRangeMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662558245114703250" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-radiobuttonlist-with_09.html"&gt;How to DataBind RadioButtonList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-dropdownlist-with.html"&gt;How to DataBind DropDownList with Dictionary DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-elements-from.html"&gt;How to remove all elements from the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-arraylist-to-compatible.html"&gt;How to copy ArrayList to a compatible Array, starting at the specified index of the array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/generic-list-remove-how-to-remove-first.html"&gt;Generic List Remove() - How to remove the first occurrence of a specific object from the List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-use-systemcollectionsarraylist.html"&gt;How to use System.Collections.ArrayList IndexOf(Object, Int32, Int32) Method&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-how-to-reverse-order-of.html"&gt;ArrayList - How to reverse the order of the elements in the specified range&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/generic-list-contains-how-to-check.html"&gt;Generic List Contains() - How to check an element is exists in the List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-sort-elements-in-entire.html"&gt;How to sort the elements in the entire ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-toarray-how-to-copy-elements.html"&gt;ArrayList ToArray() - How to copy the elements of the ArrayList to a new Object array&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8918522310860265624?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8918522310860265624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8918522310860265624'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/arraylist-setrange-how-to-copy-elements.html' title='ArrayList SetRange() - How to copy the elements of a collection over a range of elements in the ArrayList'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-wRYXlfyADFY/TpVyl7vGGpI/AAAAAAAAJW0/ES7Wzevqxus/s72-c/ArrayListSetRangeMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-1947486336768781803</id><published>2011-10-12T03:47:00.000-07:00</published><updated>2011-11-29T07:10:56.275-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>ArrayList - How to reverse the order of the elements in the specified range</title><content type='html'>&lt;div class="aspposttitle"&gt;
ArrayList - How to reverse the order of the elements in the specified range
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListReverseMethodWithRange.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() { "DimGray", "Gold", "Green", "Ivory", "LightSalmon" };

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=SeaGreen&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        colors.Reverse(1,3);

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call Reverse(index 1, count 3) Method";
        Label1.Text += "&amp;lt;br /&amp;gt;Now ArrayList Elements....";

        Label1.Text += "&amp;lt;font color=DeepPink&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;ArrayList - How to reverse the order of the elements in the specified range&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList Reverse(Int32, Int32) Method
            &amp;lt;br /&amp;gt; How to reverse the order of the elements in the specified range
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="625" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DarkSalmon"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList Reverse(Int32, Int32) Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-6GASJ-B9sk8/TpVxU1TqVqI/AAAAAAAAJWc/-LRq2xEFQZM/s1600/ArrayListReverseMethodWithRange.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="http://1.bp.blogspot.com/-6GASJ-B9sk8/TpVxU1TqVqI/AAAAAAAAJWc/-LRq2xEFQZM/s400/ArrayListReverseMethodWithRange.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662556709209134754" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-Arb9a5gnWJU/TpVxcm5nzAI/AAAAAAAAJWo/aGN3Z17v2K0/s1600/ArrayListReverseMethodWithRange1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 329px;" src="http://1.bp.blogspot.com/-Arb9a5gnWJU/TpVxcm5nzAI/AAAAAAAAJWo/aGN3Z17v2K0/s400/ArrayListReverseMethodWithRange1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662556842780773378" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-element-at-specified.html"&gt;How to remove the element at the specified index of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-setrange-how-to-copy-elements.html"&gt;ArrayList SetRange() - How to copy the elements of a collection over a range of elements in the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-sort-elements-in-entire.html"&gt;How to sort the elements in the entire ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-toarray-how-to-copy-elements.html"&gt;ArrayList ToArray() - How to copy the elements of the ArrayList to a new Object array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-isfixedsize-property-how-to.html"&gt;ArrayList IsFixedSize Property - How to get whether the ArrayList has a fixed size&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack.html"&gt;How to initialize a new instance of Stack class that contains elements copied from specified collection&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack_15.html"&gt;How to initialize a new instance of the Stack class with default initial capacity&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-listbox-using-stack.html"&gt;How to DataBind ListBox using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-pop-method-how-to-remove-and-get.html"&gt;Stack Pop() Method - How to remove and get the object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-toarray-method-how-to-copy-stack.html"&gt;Stack ToArray() Method - How to copy the Stack to a new array&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-1947486336768781803?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1947486336768781803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/1947486336768781803'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/arraylist-how-to-reverse-order-of.html' title='ArrayList - How to reverse the order of the elements in the specified range'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-6GASJ-B9sk8/TpVxU1TqVqI/AAAAAAAAJWc/-LRq2xEFQZM/s72-c/ArrayListReverseMethodWithRange.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-307209631495102435</id><published>2011-10-12T03:01:00.000-07:00</published><updated>2011-11-29T07:09:22.988-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to reverse order of the elements in the entire ArrayList</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to reverse order of the elements in the entire ArrayList
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListReverseMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() { "DarkTurquoise", "DeepSkyBlue", "DarkGreen", "Fuchsia", "GainsBoro" };

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=DarkOrchid&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        colors.Reverse();

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call Reverse() Method";
        Label1.Text += "&amp;lt;br /&amp;gt;Now ArrayList Elements....";

        Label1.Text += "&amp;lt;font color=Crimson&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to reverse order of the elements in the entire ArrayList&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList Reverse() Method
            &amp;lt;br /&amp;gt; How to reverse the order of the elements in the entire ArrayList
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="610" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DarkSlateBlue"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList Reverse() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-vpVw3lveF7A/TpVloC4MtnI/AAAAAAAAJWE/5ImDGIVCtPY/s1600/ArrayListReverseMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="http://4.bp.blogspot.com/-vpVw3lveF7A/TpVloC4MtnI/AAAAAAAAJWE/5ImDGIVCtPY/s400/ArrayListReverseMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662543845130024562" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-rSLlZAV_Bbs/TpVmTJCDJgI/AAAAAAAAJWQ/hpfz42UHkYY/s1600/ArrayListReverseMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 333px;" src="http://3.bp.blogspot.com/-rSLlZAV_Bbs/TpVmTJCDJgI/AAAAAAAAJWQ/hpfz42UHkYY/s400/ArrayListReverseMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662544585516328450" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-element-at-specified.html"&gt;How to remove the element at the specified index of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-first-occurrence-of.html"&gt;How to remove first occurrence of a specific object from ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-range-of-elements-from.html"&gt;How to remove a range of elements from ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-dropdownlist-using.html"&gt;How to DataBind DropDownList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-listbox-using-stack.html"&gt;How to DataBind ListBox using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-stack-to-existing-one.html"&gt;How to copy Stack to an existing one-dimensional Array, starting at the specified array index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-peek-method-how-to-get-object-at.html"&gt;Stack Peek() Method - How to get the object at the top of the Stack without removing it&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-pop-method-how-to-remove-and-get.html"&gt;Stack Pop() Method - How to remove and get the object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-push-method-how-to-insert-object.html"&gt;Stack Push() Method - How to insert an object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-toarray-method-how-to-copy-stack.html"&gt;Stack ToArray() Method - How to copy the Stack to a new array&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-307209631495102435?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/307209631495102435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/307209631495102435'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-reverse-order-of-elements-in.html' title='How to reverse order of the elements in the entire ArrayList'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-vpVw3lveF7A/TpVloC4MtnI/AAAAAAAAJWE/5ImDGIVCtPY/s72-c/ArrayListReverseMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8059238183012451810</id><published>2011-10-12T02:55:00.000-07:00</published><updated>2011-11-29T07:08:02.851-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to remove a range of elements from ArrayList</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to remove a range of elements from ArrayList
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListRemoveRangeMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() { "Pink", "Peru", "Plum", "Snow", "Blue","White" };

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=DeepBlue&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        colors.RemoveRange(2,3);

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call RemoveRange(index 2, count 3) Method";
        Label1.Text += "&amp;lt;br /&amp;gt;Now ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=DarkSlateGray&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to remove a range of elements from ArrayList&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList RemoveRange() Method
            &amp;lt;br /&amp;gt; How to remove a range of elements from the ArrayList
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="575" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="Orchid"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList RemoveRange() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-twg2Hx1eqNc/TpVkNqNkiOI/AAAAAAAAJVs/ZPoO8bI3m-U/s1600/ArrayListRemoveRangeMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 269px;" src="http://2.bp.blogspot.com/-twg2Hx1eqNc/TpVkNqNkiOI/AAAAAAAAJVs/ZPoO8bI3m-U/s400/ArrayListRemoveRangeMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662542292320553186" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-nG5rAtUyXvQ/TpVkVy7X_fI/AAAAAAAAJV4/erBbIJ0romo/s1600/ArrayListRemoveRangeMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 350px;" src="http://2.bp.blogspot.com/-nG5rAtUyXvQ/TpVkVy7X_fI/AAAAAAAAJV4/erBbIJ0romo/s400/ArrayListRemoveRangeMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662542432099106290" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-element-at-specified.html"&gt;How to remove the element at the specified index of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-first-occurrence-of.html"&gt;How to remove first occurrence of a specific object from ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-reverse-order-of-elements-in.html"&gt;How to reverse order of the elements in the entire ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-sort-elements-in-entire.html"&gt;How to sort the elements in the entire ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-toarray-how-to-copy-elements.html"&gt;ArrayList ToArray() - How to copy the elements of the ArrayList to a new Object array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-count-how-to-get-number-of.html"&gt;ArrayList Count - How to get number of elements actually contained in the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-isfixedsize-property-how-to.html"&gt;ArrayList IsFixedSize Property - How to get whether the ArrayList has a fixed size&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-item-property-how-to-get-or.html"&gt;ArrayList Item Property - How to get or set the element at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-objects-from-stack.html"&gt;How to remove all objects from the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack.html"&gt;How to initialize a new instance of Stack class that contains elements copied from specified collection&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8059238183012451810?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8059238183012451810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8059238183012451810'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-remove-range-of-elements-from.html' title='How to remove a range of elements from ArrayList'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-twg2Hx1eqNc/TpVkNqNkiOI/AAAAAAAAJVs/ZPoO8bI3m-U/s72-c/ArrayListRemoveRangeMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-4101792409832407994</id><published>2011-10-12T02:50:00.000-07:00</published><updated>2011-11-29T07:07:00.830-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to remove first occurrence of a specific object from ArrayList</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to remove first occurrence of a specific object from ArrayList
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListRemoveMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() { "Yellow", "Violet", "Yellow", "DarkGray", "DeepPink" };

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=OliveDrab&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        colors.Remove("Yellow");

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call Remove(object Yellow) Method";
        Label1.Text += "&amp;lt;font color=Red&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to remove first occurrence of a specific object from ArrayList&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList Remove() Method
            &amp;lt;br /&amp;gt; How to remove the first occurrence of a specific object from the ArrayList
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="675" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="Orchid"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList Remove() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-PmzaOoYctvk/TpVjB4uI59I/AAAAAAAAJVU/ev3cKSumE34/s1600/ArrayListRemoveMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 243px;" src="http://3.bp.blogspot.com/-PmzaOoYctvk/TpVjB4uI59I/AAAAAAAAJVU/ev3cKSumE34/s400/ArrayListRemoveMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662540990545192914" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-gUzWAOzZeJw/TpVjJfHJX6I/AAAAAAAAJVg/rb73ikFdzmA/s1600/ArrayListRemoveMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 265px;" src="http://2.bp.blogspot.com/-gUzWAOzZeJw/TpVjJfHJX6I/AAAAAAAAJVg/rb73ikFdzmA/s400/ArrayListRemoveMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662541121109712802" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-get-arraylist-which-represents.html"&gt;How to get an ArrayList which represents a subset of the elements in the source ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-search-specified-object-and-get.html"&gt;How to search specified Object and get zero-based index of the first occurrence within the entire ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-search-specified-object-get-zero.html"&gt;How to search specified Object, get zero-based index of first occurrence within the range of elements in ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-use-systemcollectionsarraylist.html"&gt;How to use System.Collections.ArrayList IndexOf(Object, Int32, Int32) Method&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-insert-element-into-arraylist-at.html"&gt;How to insert an element into the ArrayList at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-insert-elements-of-collection.html"&gt;How to insert the elements of a collection into the ArrayList at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-lastindexof-how-to-search.html"&gt;ArrayList LastIndexOf() - How to search specified Object and get index of last occurrence&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-element-at-specified.html"&gt;How to remove the element at the specified index of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-range-of-elements-from.html"&gt;How to remove a range of elements from ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-reverse-order-of-elements-in.html"&gt;How to reverse order of the elements in the entire ArrayList&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-4101792409832407994?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4101792409832407994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/4101792409832407994'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-remove-first-occurrence-of.html' title='How to remove first occurrence of a specific object from ArrayList'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-PmzaOoYctvk/TpVjB4uI59I/AAAAAAAAJVU/ev3cKSumE34/s72-c/ArrayListRemoveMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-6039400898462596119</id><published>2011-10-12T02:45:00.000-07:00</published><updated>2011-11-29T07:06:03.273-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to remove the element at the specified index of the ArrayList</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to remove the element at the specified index of the ArrayList
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListRemoveAtMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() { "WhiteSmoke", "Wheat", "SteelBlue", "SlateGray", "Thistle" };

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=SandyBrown&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        colors.RemoveAt(3);

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After Call RemoveAt(index 3) Method";
        Label1.Text += "&amp;lt;br /&amp;gt;Now ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=Tomato&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to remove the element at the specified index of the ArrayList&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList RemoveAt() Method
            &amp;lt;br /&amp;gt; How to remove the element at the specified index of the ArrayList
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="665" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="Orchid"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList RemoveAt() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-2dx4KCNdm1A/TpVhyiyrlKI/AAAAAAAAJU8/2kOOEwpQeiU/s1600/ArrayListRemoveAtMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 253px;" src="http://1.bp.blogspot.com/-2dx4KCNdm1A/TpVhyiyrlKI/AAAAAAAAJU8/2kOOEwpQeiU/s400/ArrayListRemoveAtMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662539627448997026" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-wi6M2IIiZ8U/TpVh8BAfGEI/AAAAAAAAJVI/I-VJH3Tq6YU/s1600/ArrayListRemoveAtMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 304px;" src="http://3.bp.blogspot.com/-wi6M2IIiZ8U/TpVh8BAfGEI/AAAAAAAAJVI/I-VJH3Tq6YU/s400/ArrayListRemoveAtMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662539790178785346" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-radiobuttonlist-with_09.html"&gt;How to DataBind RadioButtonList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-create-and-use-arraylist.html"&gt;How to create and use ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-add-object-to-end-of-arraylist.html"&gt;How to add an object to the end of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-addrange-how-to-add-elements.html"&gt;ArrayList AddRange() - How to add the elements of an ICollection to the end of the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-elements-from.html"&gt;How to remove all elements from the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-determine-whether-element-exists.html"&gt;How to determine whether an element exists in ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-copyto-how-to-copy-entire.html"&gt;ArrayList CopyTo() - How to copy the entire ArrayList to a compatible one-dimensional Array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-first-occurrence-of.html"&gt;How to remove first occurrence of a specific object from ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-range-of-elements-from.html"&gt;How to remove a range of elements from ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-reverse-order-of-elements-in.html"&gt;How to reverse order of the elements in the entire ArrayList&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-6039400898462596119?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/6039400898462596119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/6039400898462596119'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-remove-element-at-specified.html' title='How to remove the element at the specified index of the ArrayList'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-2dx4KCNdm1A/TpVhyiyrlKI/AAAAAAAAJU8/2kOOEwpQeiU/s72-c/ArrayListRemoveAtMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-6799982170413844232</id><published>2011-10-12T02:39:00.000-07:00</published><updated>2011-11-29T07:04:32.279-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>ArrayList LastIndexOf() - How to search specified Object and get index of last occurrence</title><content type='html'>&lt;div class="aspposttitle"&gt;
ArrayList LastIndexOf() - How to search specified Object and get index of last occurrence
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListLastIndexOfMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() {"BlanchedAlmond","Brown","Cornsilk","Brown","CadetBlue"};

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=DarkGreen&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;LastIndexOf(object) Method";
        Label1.Text += "&amp;lt;font color=Red&amp;gt;";
        Label1.Text += "&amp;lt;br /&amp;gt;Last Index Of 'Brown': " +colors.LastIndexOf("Brown").ToString();
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;ArrayList LastIndexOf() - How to search specified Object and get index of last occurrence&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList LastIndexOf() Method
            &amp;lt;br /&amp;gt; How to search specified Object and get index of last occurrence
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="625" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="Orchid"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList LastIndexOf() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-eDx-5XWDueA/TpVge4x6s8I/AAAAAAAAJUk/PH97kjRK2BQ/s1600/ArrayListLastIndexOfMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 251px;" src="http://1.bp.blogspot.com/-eDx-5XWDueA/TpVge4x6s8I/AAAAAAAAJUk/PH97kjRK2BQ/s400/ArrayListLastIndexOfMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662538190242362306" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-dQlqTPnEsGU/TpVgr3_7sPI/AAAAAAAAJUw/UngbaZX93bE/s1600/ArrayListLastIndexOfMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 269px;" src="http://2.bp.blogspot.com/-dQlqTPnEsGU/TpVgr3_7sPI/AAAAAAAAJUw/UngbaZX93bE/s400/ArrayListLastIndexOfMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662538413371011314" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-bulletedlist-with_09.html"&gt;How to DataBind BulletedList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-checkboxlist-with_09.html"&gt;How to DataBind CheckBoxList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-dropdownlist-with_09.html"&gt;How to DataBind DropDownList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-listbox-with-generic.html"&gt;How to DataBind ListBox with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-radiobuttonlist-with_09.html"&gt;How to DataBind RadioButtonList with Generic List&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-use-systemcollectionsarraylist.html"&gt;How to use System.Collections.ArrayList IndexOf(Object, Int32, Int32) Method&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-insert-element-into-arraylist-at.html"&gt;How to insert an element into the ArrayList at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-insert-elements-of-collection.html"&gt;How to insert the elements of a collection into the ArrayList at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-push-method-how-to-insert-object.html"&gt;Stack Push() Method - How to insert an object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-toarray-method-how-to-copy-stack.html"&gt;Stack ToArray() Method - How to copy the Stack to a new array&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-6799982170413844232?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/6799982170413844232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/6799982170413844232'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/arraylist-lastindexof-how-to-search.html' title='ArrayList LastIndexOf() - How to search specified Object and get index of last occurrence'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-eDx-5XWDueA/TpVge4x6s8I/AAAAAAAAJUk/PH97kjRK2BQ/s72-c/ArrayListLastIndexOfMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-3295305428530390588</id><published>2011-10-11T09:55:00.001-07:00</published><updated>2011-11-29T07:03:31.835-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to insert the elements of a collection into the ArrayList at the specified index</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to insert the elements of a collection into the ArrayList at the specified index
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListInsertRangeMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() {"Green","SeaGreen","SpringGreen","LawnGreen"};

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=Green&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        List&amp;lt;string&amp;gt; redColors = new List&amp;lt;string&amp;gt;() {"Red","DarkRed","IndianRed" };
        colors.InsertRange(2,redColors);

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After call InsertRange(index 2, ICollection) Method";
        Label1.Text+= "&amp;lt;br /&amp;gt;&amp;lt;u&amp;gt;Now ArrayList Elements&amp;lt;/u&amp;gt;...";
        Label1.Text += "&amp;lt;font color=Red&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to insert the elements of a collection into the ArrayList at the specified index&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList InsertRange() Method
            &amp;lt;br /&amp;gt; How to insert the elements of a collection
            &amp;lt;br /&amp;gt; into the ArrayList at the specified index
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="475" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="Orchid"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList InsertRange() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-Blrwo9-q6Ws/TpR1AYOJ5gI/AAAAAAAAJUM/t5RIIRuVbjw/s1600/ArrayListInsertRangeMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 265px;" src="http://1.bp.blogspot.com/-Blrwo9-q6Ws/TpR1AYOJ5gI/AAAAAAAAJUM/t5RIIRuVbjw/s400/ArrayListInsertRangeMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662279280873825794" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-Th26_tRHASc/TpR1GyHIPrI/AAAAAAAAJUY/MaesWNS5lSM/s1600/ArrayListInsertRangeMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 398px;" src="http://2.bp.blogspot.com/-Th26_tRHASc/TpR1GyHIPrI/AAAAAAAAJUY/MaesWNS5lSM/s400/ArrayListInsertRangeMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662279390902894258" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-use-systemcollectionsarraylist.html"&gt;How to use System.Collections.ArrayList IndexOf(Object, Int32, Int32) Method&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-insert-element-into-arraylist-at.html"&gt;How to insert an element into the ArrayList at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-lastindexof-how-to-search.html"&gt;ArrayList LastIndexOf() - How to search specified Object and get index of last occurrence&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-dropdownlist-using.html"&gt;How to DataBind DropDownList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-listbox-using-stack.html"&gt;How to DataBind ListBox using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-radiobuttonlist-using.html"&gt;How to DataBind RadioButtonList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-stack-to-existing-one.html"&gt;How to copy Stack to an existing one-dimensional Array, starting at the specified array index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-peek-method-how-to-get-object-at.html"&gt;Stack Peek() Method - How to get the object at the top of the Stack without removing it&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-pop-method-how-to-remove-and-get.html"&gt;Stack Pop() Method - How to remove and get the object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-toarray-method-how-to-copy-stack.html"&gt;Stack ToArray() Method - How to copy the Stack to a new array&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-3295305428530390588?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3295305428530390588'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3295305428530390588'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-insert-elements-of-collection.html' title='How to insert the elements of a collection into the ArrayList at the specified index'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-Blrwo9-q6Ws/TpR1AYOJ5gI/AAAAAAAAJUM/t5RIIRuVbjw/s72-c/ArrayListInsertRangeMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8107420088276317461</id><published>2011-10-11T09:50:00.000-07:00</published><updated>2011-11-29T07:02:27.570-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to insert an element into the ArrayList at the specified index</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to insert an element into the ArrayList at the specified index
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListInsertMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() {"BurlyWood","Coral","Indigo","CadetBlue"};

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=Crimson&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        colors.Insert(1,"Orchid");

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;After call Insert(index 1, object Orchid) Method";
        Label1.Text+= "&amp;lt;br /&amp;gt;&amp;lt;u&amp;gt;Now ArrayList Elements&amp;lt;/u&amp;gt;...";
        Label1.Text += "&amp;lt;font color=OrangeRed&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to insert an element into the ArrayList at the specified index&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList Insert() Method
            &amp;lt;br /&amp;gt; How to insert an element into the ArrayList at the specified index
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="650" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="OliveDrab"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList Insert() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-EOifxrn382g/TpRz70882PI/AAAAAAAAJT0/RILz4Thwaes/s1600/ArrayListInsertMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 246px;" src="http://2.bp.blogspot.com/-EOifxrn382g/TpRz70882PI/AAAAAAAAJT0/RILz4Thwaes/s400/ArrayListInsertMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662278103175321842" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-Z9qZw6nk35k/TpR0Cq0nr3I/AAAAAAAAJUA/J3hwg5C2f64/s1600/ArrayListInsertMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 309px;" src="http://4.bp.blogspot.com/-Z9qZw6nk35k/TpR0Cq0nr3I/AAAAAAAAJUA/J3hwg5C2f64/s400/ArrayListInsertMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662278220715110258" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-use-systemcollectionsarraylist.html"&gt;How to use System.Collections.ArrayList IndexOf(Object, Int32, Int32) Method&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-insert-elements-of-collection.html"&gt;How to insert the elements of a collection into the ArrayList at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-lastindexof-how-to-search.html"&gt;ArrayList LastIndexOf() - How to search specified Object and get index of last occurrence&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-objects-from-stack.html"&gt;How to remove all objects from the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack.html"&gt;How to initialize a new instance of Stack class that contains elements copied from specified collection&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-count-how-to-get-number-of.html"&gt;Stack Count - How to Get the number of elements contained in the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack_15.html"&gt;How to initialize a new instance of the Stack class with default initial capacity&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-checkboxlist-using.html"&gt;How to DataBind CheckBoxList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-dropdownlist-using.html"&gt;How to DataBind DropDownList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-listbox-using-stack.html"&gt;How to DataBind ListBox using Stack DataSource&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-8107420088276317461?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8107420088276317461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/8107420088276317461'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-insert-element-into-arraylist-at.html' title='How to insert an element into the ArrayList at the specified index'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-EOifxrn382g/TpRz70882PI/AAAAAAAAJT0/RILz4Thwaes/s72-c/ArrayListInsertMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-6100733091388638990</id><published>2011-10-11T09:45:00.000-07:00</published><updated>2011-11-29T07:01:13.734-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to use System.Collections.ArrayList IndexOf(Object, Int32, Int32) Method</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to use System.Collections.ArrayList IndexOf(Object, Int32, Int32) Method
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListIndexOfMethodWithStartIndexAndCount.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() { "ForestGreen", "Orange", "SkyBlue", "Navy", "Orange", "Olive" };

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=SkyBlue&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;IndexOf(object Orange, startIndex 2, count 4)";
        Label1.Text += "&amp;lt;font color=Crimson&amp;gt;";
        Label1.Text += "&amp;lt;br /&amp;gt;Index of 'Orange': " + colors.IndexOf("Orange", 2, 4);
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to use System.Collections.ArrayList IndexOf(Object, Int32, Int32) Method&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList IndexOf(Object, Int32, Int32) Method
            &amp;lt;br /&amp;gt; How to search specified Object and get zero-based index of first
            &amp;lt;br /&amp;gt; occurrence within the range of elements in ArrayList that starts
            &amp;lt;br /&amp;gt; at specified index and contains specified number of elements
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="575" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DarkOrchid"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList IndexOf(Object, Int32, Int32) Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-29NKfIGXLGg/TpRy2AXjQsI/AAAAAAAAJTc/VSJCuNNMvw4/s1600/ArrayListIndexOfMethodWithStartIndexAndCount.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 277px;" src="http://2.bp.blogspot.com/-29NKfIGXLGg/TpRy2AXjQsI/AAAAAAAAJTc/VSJCuNNMvw4/s400/ArrayListIndexOfMethodWithStartIndexAndCount.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662276903648838338" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-foOZ3oBmSkI/TpRy_Ey1PMI/AAAAAAAAJTo/1-sYqD6rt18/s1600/ArrayListIndexOfMethodWithStartIndexAndCount1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 293px;" src="http://4.bp.blogspot.com/-foOZ3oBmSkI/TpRy_Ey1PMI/AAAAAAAAJTo/1-sYqD6rt18/s400/ArrayListIndexOfMethodWithStartIndexAndCount1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662277059455827138" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-insert-element-into-arraylist-at.html"&gt;How to insert an element into the ArrayList at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-insert-elements-of-collection.html"&gt;How to insert the elements of a collection into the ArrayList at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-lastindexof-how-to-search.html"&gt;ArrayList LastIndexOf() - How to search specified Object and get index of last occurrence&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-range-of-elements-from.html"&gt;How to remove a range of elements from ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-reverse-order-of-elements-in.html"&gt;How to reverse order of the elements in the entire ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-sort-elements-in-entire.html"&gt;How to sort the elements in the entire ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-toarray-how-to-copy-elements.html"&gt;ArrayList ToArray() - How to copy the elements of the ArrayList to a new Object array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-capacity-how-to-get-or-set.html"&gt;ArrayList Capacity - How to get or set number of elements that ArrayList can contain&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-count-how-to-get-number-of.html"&gt;ArrayList Count - How to get number of elements actually contained in the ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-isfixedsize-property-how-to.html"&gt;ArrayList IsFixedSize Property - How to get whether the ArrayList has a fixed size&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-6100733091388638990?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/6100733091388638990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/6100733091388638990'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-use-systemcollectionsarraylist.html' title='How to use System.Collections.ArrayList IndexOf(Object, Int32, Int32) Method'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-29NKfIGXLGg/TpRy2AXjQsI/AAAAAAAAJTc/VSJCuNNMvw4/s72-c/ArrayListIndexOfMethodWithStartIndexAndCount.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-3078858912056243773</id><published>2011-10-11T09:40:00.001-07:00</published><updated>2011-11-29T06:59:55.249-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to search specified Object, get zero-based index of first occurrence within the range of elements in ArrayList</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to search specified Object, get zero-based index of first occurrence within the range of elements in ArrayList
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListIndexOfMethodWithStartIndex.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() {"Green","Blue","Red","Peru","Blue","Salmon"};

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=DarkOrange&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;IndexOf(object Blue, startIndex 2)";
        Label1.Text += "&amp;lt;font color=DarkGreen&amp;gt;";
        Label1.Text += "&amp;lt;br /&amp;gt;Index of 'Blue': " + colors.IndexOf("Blue", 2);
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to search specified Object, get zero-based index of first occurrence within the range of elements in ArrayList&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList IndexOf(Object, Int32) Method
            &amp;lt;br /&amp;gt; How to search specified Object, get zero-based index
            &amp;lt;br /&amp;gt; of first occurrence within the range of elements in ArrayList
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="575" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="DarkOrchid"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList IndexOf(Object, Int32) Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-BN2HQlMo_3w/TpRxgkvi0aI/AAAAAAAAJTE/-7SnfIPth_E/s1600/ArrayListIndexOfMethodWithStartIndex.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 270px;" src="http://3.bp.blogspot.com/-BN2HQlMo_3w/TpRxgkvi0aI/AAAAAAAAJTE/-7SnfIPth_E/s400/ArrayListIndexOfMethodWithStartIndex.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662275435944399266" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/--mDW-OFEEKA/TpRxnV3s3EI/AAAAAAAAJTQ/xNANLoyGA5E/s1600/ArrayListIndexOfMethodWithStartIndex1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 314px;" src="http://4.bp.blogspot.com/--mDW-OFEEKA/TpRxnV3s3EI/AAAAAAAAJTQ/xNANLoyGA5E/s400/ArrayListIndexOfMethodWithStartIndex1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662275552211164226" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-arraylist-to-compatible.html"&gt;How to copy ArrayList to a compatible Array, starting at the specified index of the array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-get-arraylist-which-represents.html"&gt;How to get an ArrayList which represents a subset of the elements in the source ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-search-specified-object-and-get.html"&gt;How to search specified Object and get zero-based index of the first occurrence within the entire ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-all-objects-from-stack.html"&gt;How to remove all objects from the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack.html"&gt;How to initialize a new instance of Stack class that contains elements copied from specified collection&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-determine-whether-element-is-in.html"&gt;How to determine whether an element is in the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-count-how-to-get-number-of.html"&gt;Stack Count - How to Get the number of elements contained in the Stack&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-initialize-new-instance-of-stack_15.html"&gt;How to initialize a new instance of the Stack class with default initial capacity&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-dropdownlist-using.html"&gt;How to DataBind DropDownList using Stack DataSource&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-databind-listbox-using-stack.html"&gt;How to DataBind ListBox using Stack DataSource&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-3078858912056243773?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3078858912056243773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/3078858912056243773'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-search-specified-object-get-zero.html' title='How to search specified Object, get zero-based index of first occurrence within the range of elements in ArrayList'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-BN2HQlMo_3w/TpRxgkvi0aI/AAAAAAAAJTE/-7SnfIPth_E/s72-c/ArrayListIndexOfMethodWithStartIndex.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-7729799971328585121</id><published>2011-10-11T09:33:00.000-07:00</published><updated>2011-11-29T06:58:46.381-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='System.Collections Example'/><title type='text'>How to search specified Object and get zero-based index of the first occurrence within the entire ArrayList</title><content type='html'>&lt;div class="aspposttitle"&gt;
How to search specified Object and get zero-based index of the first occurrence within the entire ArrayList
&lt;/div&gt;

&lt;div class="filenamewrapper"&gt;
    &lt;div class="filename"&gt;
     ArrayListIndexOfMethod.aspx
    &lt;/div&gt;
&lt;/div&gt;

&lt;pre class="xhtml" name="code"&gt;
&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;script runat="server"&amp;gt;
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() {"Olive","HotPink","White","Peru","Pink","Yellow"};

        Label1.Text = "ArrayList Elements....";
        Label1.Text += "&amp;lt;font color=DodgerBlue&amp;gt;";
        foreach (string color in colors)
        {
            Label1.Text += "&amp;lt;br /&amp;gt;" + color;
        }
        Label1.Text += "&amp;lt;/font&amp;gt;";

        Label1.Text += "&amp;lt;font color=HotPink&amp;gt;";
        Label1.Text += "&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;Index of 'White': " + colors.IndexOf("White");
        Label1.Text += "&amp;lt;/font&amp;gt;";
    }
&amp;lt;/script&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;
&amp;lt;head id="Head1" runat="server"&amp;gt;
    &amp;lt;title&amp;gt;How to search specified Object and get zero-based index of the first occurrence within the entire ArrayList&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;
        &amp;lt;h2 style="color:MidnightBlue; font-style:italic;"&amp;gt;
            System.Collections.ArrayList IndexOf() Method
            &amp;lt;br /&amp;gt; How to search specified Object and get zero-based
            &amp;lt;br /&amp;gt; index of the first occurrence within the entire ArrayList
        &amp;lt;/h2&amp;gt;
        &amp;lt;hr width="550" align="left" color="Navy" /&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;asp:Label
             ID="Label1"
             runat="server"
             ForeColor="Green"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             &amp;gt;
        &amp;lt;/asp:Label&amp;gt;
        &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;
        &amp;lt;asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList IndexOf() Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            /&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
  
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/--I3NPT2X0oc/TpRwDr9wLoI/AAAAAAAAJSs/Buz5emM8bLY/s1600/ArrayListIndexOfMethod.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 294px;" src="http://1.bp.blogspot.com/--I3NPT2X0oc/TpRwDr9wLoI/AAAAAAAAJSs/Buz5emM8bLY/s400/ArrayListIndexOfMethod.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662273840155209346" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-Yaq-tV7vcvQ/TpRwK8EjIsI/AAAAAAAAJS4/Db17QhIjito/s1600/ArrayListIndexOfMethod1.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 324px;" src="http://1.bp.blogspot.com/-Yaq-tV7vcvQ/TpRwK8EjIsI/AAAAAAAAJS4/Db17QhIjito/s400/ArrayListIndexOfMethod1.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5662273964737766082" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;


&lt;div class="RelatedHeader"&gt;
 Related asp.net example
&lt;/div&gt;

&lt;div id="RelatedExamples"&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-arraylist-to-compatible.html"&gt;How to copy ArrayList to a compatible Array, starting at the specified index of the array&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-get-arraylist-which-represents.html"&gt;How to get an ArrayList which represents a subset of the elements in the source ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-search-specified-object-get-zero.html"&gt;How to search specified Object, get zero-based index of first occurrence within the range of elements in ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-insert-elements-of-collection.html"&gt;How to insert the elements of a collection into the ArrayList at the specified index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/arraylist-lastindexof-how-to-search.html"&gt;ArrayList LastIndexOf() - How to search specified Object and get index of last occurrence&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-remove-range-of-elements-from.html"&gt;How to remove a range of elements from ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-reverse-order-of-elements-in.html"&gt;How to reverse order of the elements in the entire ArrayList&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/how-to-copy-stack-to-existing-one.html"&gt;How to copy Stack to an existing one-dimensional Array, starting at the specified array index&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-peek-method-how-to-get-object-at.html"&gt;Stack Peek() Method - How to get the object at the top of the Stack without removing it&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://asp-net-example.blogspot.com/2011/10/stack-pop-method-how-to-remove-and-get.html"&gt;Stack Pop() Method - How to remove and get the object at the top of the Stack&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6907853060498268911-7729799971328585121?l=asp-net-example.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/7729799971328585121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907853060498268911/posts/default/7729799971328585121'/><link rel='alternate' type='text/html' href='http://asp-net-example.blogspot.com/2011/10/how-to-search-specified-object-and-get.html' title='How to search specified Object and get zero-based index of the first occurrence within the entire ArrayList'/><author><name>sk. saiful alam</name><uri>http://www.blogger.com/profile/16938645337644875643</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_P3ZJmNYimyo/SPRyey-2OzI/AAAAAAAAAJ0/TKzgrAujsnU/S220/asp.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/--I3NPT2X0oc/TpRwDr9wLoI/AAAAAAAAJSs/Buz5emM8bLY/s72-c/ArrayListIndexOfMethod.gif' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-6907853060498268911.post-8922606445787785822</id><published>2011-10-11T09:29:00.000-07:00</published><updated>2
