kreta/KretaWeb/Helpers/CustomStringBuilder.cs
2024-03-13 00:33:46 +01:00

56 lines
1.4 KiB
C#

using System.Text;
namespace Kreta.Web.Helpers
{
public class CustomStringBuilder
{
private StringBuilder builder = new StringBuilder();
public CustomStringBuilder Append(string s)
{
builder.Append(s);
return this;
}
public override string ToString()
{
return builder.ToString();
}
public static implicit operator CustomStringBuilder(string s)
{
var m = new CustomStringBuilder();
m.builder.Append(s);
return m;
}
public static CustomStringBuilder operator +(CustomStringBuilder m, string s)
{
return m.Append(s);
}
public CustomStringBuilder AppendFormat(string format, object arg0, object arg1, object arg2)
{
builder.AppendFormat(format, arg0, arg1, arg2);
return this;
}
public CustomStringBuilder AppendFormat(string format, params object[] args)
{
builder.AppendFormat(format, args);
return this;
}
public CustomStringBuilder AppendFormat(string format, object arg0)
{
builder.AppendFormat(format, arg0);
return this;
}
public CustomStringBuilder AppendFormat(string format, object arg0, object arg1)
{
builder.AppendFormat(format, arg0, arg1);
return this;
}
}
}