It is used to build a formatted string.Lets Look at the Example You will get the Clear Idea about it....
string spaces = " ";
StringBuilder sb = new StringBuilder();
sb.AppendFormat("Hello,");
sb.AppendFormat("<br/>");
sb.AppendFormat("<br/>{0}",spaces);
sb.AppendFormat("A new request is submitted. Details are as follows");
sb.AppendFormat("<br/>{0}", spaces);
sb.AppendFormat("<b>Page URL</b> : ");
sb.AppendFormat("<br/>{0}", spaces);
sb.AppendFormat("<b>FirstName</b> : ");
sb.AppendFormat("<br/>{0}", spaces);
sb.AppendFormat("<b>LastName</b> : ");
sb.AppendFormat("<br/>{0}", spaces);
sb.AppendFormat("<b>CompanyName</b> : ");
sb.AppendFormat("<br/>{0}", spaces);
sb.AppendFormat("<b>Phone</b> : ");
sb.AppendFormat("<br/>{0}", spaces);
sb.AppendFormat("<b>Email</b> : ");
Now If you Print sb in Page you will get Like this...
Hello,
A new request is submitted. Details are as follows
FirstName
LastName
CompanyName
Phone
Email
string spaces = " ";
StringBuilder sb = new StringBuilder();
sb.AppendFormat("Hello,");
sb.AppendFormat("<br/>");
sb.AppendFormat("<br/>{0}",spaces);
sb.AppendFormat("A new request is submitted. Details are as follows");
sb.AppendFormat("<br/>{0}", spaces);
sb.AppendFormat("<b>Page URL</b> : ");
sb.AppendFormat("<br/>{0}", spaces);
sb.AppendFormat("<b>FirstName</b> : ");
sb.AppendFormat("<br/>{0}", spaces);
sb.AppendFormat("<b>LastName</b> : ");
sb.AppendFormat("<br/>{0}", spaces);
sb.AppendFormat("<b>CompanyName</b> : ");
sb.AppendFormat("<br/>{0}", spaces);
sb.AppendFormat("<b>Phone</b> : ");
sb.AppendFormat("<br/>{0}", spaces);
sb.AppendFormat("<b>Email</b> : ");
Now If you Print sb in Page you will get Like this...
Hello,
A new request is submitted. Details are as follows
FirstName
LastName
CompanyName
Phone
0 comments:
Post a Comment