.NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services, .NET articles, Sharepoint 2010, visual studio 2010,Aamir Hasan,IT
wwwSW
Posted by
Aamir Hasan
on
Sunday, December 5, 2010
Total Views:
In this example, I have told you how to clear all char from current StringBuilder class instance, clear method is a new feature of .Net Framework 4.O.
Here’s an example
Following is code of default.aspx page.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Visual Studio 2010 - Clear StringBuilder</title>
<style type="text/css">
html, body
{
font-family: Verdana;
font-size: 11px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
Following is the code behind script of Default.aspx.cs page.
protected void Page_Load(object sender, EventArgs e)
{
var sb = new StringBuilder();
sb.Append("this is demo ");
sb.Append("<br>");
sb.Append("Author:");
Label1.Text = sb.ToString();
sb.Clear();
sb.Append("Welcome to aspxtutorial.com");
sb.Append("<br>");
sb.Append("Author:Aamir Hasan");
Label1.Text = sb.ToString();
}
Note:Clear method is new feature of .Net Framework 4.O, in pervious version we used StringBuilder.Length=0 to clean the StringBuilder class instance.
Download
StringBuilder.zip (965.00 bytes)
49bee98b-5ad6-439c-a7f4-a3a8bf3e4e7f|1|5.0
Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5