本文介绍了在C#中使用字符串的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在c#中使用字符串在html中创建表?
is it possbile to create a table in html using string in c#??
public void Paging(ref StringBuilder strHtml, int pageIndex, int pagingCount, int rowCount, string listView, string controller, int position)
{
try
{
strHtml.Append("<table class='Dsply' border='0' cellspacing='0'
}
cellpadding='0'><tr><th>");
Instead of the string builder if i use a string will i be able to create one table?
推荐答案
strHtml = strHtml + "new string";
或
or
strHtml += "new string";
字符串类没有Append方法.
如果使用StringBuilder,则不需要ref
参数-如果要更改"字符串,则不需要此参数.
就我个人而言,我放弃了ref
参数,使用StringBuilder并将其作为方法的结果返回:
The string class does not have an Append method.
If you use a StringBuilder, you do not need the ref
parameter - you do if you want to "change" the string.
Personally, I would ditch the ref
parameter, use a StringBuilder and return it as the result of the method anyway:
public StringBuilder Paging(StringBuilder strHtml, int pageIndex, int pagingCount, int rowCount, string listView, string controller, int position)
{
strHtml.Append("<table class="Dsply" border="0" cellspacing="0" cellpadding="0"><tr><th>");
return strHtml;
}</th></tr></table>
这篇关于在C#中使用字符串的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!