Example of Append string using StringBuilder class in asp.net

 <form id="form1" runat="server">
    <asp:Button ID="Button1"
     runat="server"
     onclick="Button1_Click"
     Text="Click"
        Width="74px" BackColor="#FF6666" />
    <div style="width: 93px">
   
        <asp:Label ID="Label1"
         runat="server"
         Text="Label" BackColor="Yellow" ForeColor="Black"></asp:Label>
   
    </div>
    </form>

 Code Behind

 protected void Button1_Click(object sender, System.EventArgs e)  
       {

        StringBuilder stringA = new StringBuilder();
        stringA.Append("those are text. ");
        StringBuilder stringA2 = new StringBuilder(" another text.");

        stringA.Append(stringA2);

        Label1.Text = stringA.ToString(); 
    }

Code Generate the following outputExample of Append string using StringBuilder class in asp.net

Example of Append string using StringBuilder class in asp.net Example of Append string using StringBuilder class in asp.net Reviewed by Jackrin Reacher on May 27, 2014 Rating: 5

No comments