|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Zigrem.Text
{
public partial class StringBuilderPlus
{
/// <summary>
/// Simple class to wrap a plain string.
/// </summary>
private class PlainString : IString
{
#region Static Variables
/// <summary>
/// PlainString's version of string.Emtpy.
/// </summary>
public static readonly PlainString Empty;
#endregion
#region Variables
private string stringValue;
#endregion
#region Properties
/// <summary>
/// The value stored by this plain string.
/// </summary>
private string StringValue
{
get
{
return this.stringValue;
}
set
{
this.stringValue = value;
}
}
/// <summary>
/// The length of this string.
/// </summary>
public int Length
{
get
{
return this.StringValue.Length;
}
}
#endregion
#region Constructors
/// <summary>
/// Create a plain string from a normal string.
/// </summary>
/// <param name="str">The string to wrap.</param>
public PlainString(string str)
{
this.StringValue = str;
}
/// <summary>
/// Static constructor.
/// </summary>
static PlainString()
{
Empty = new PlainString(string.Empty);
}
#endregion
#region Methods
/// <summary>
/// Appends the string stored by this plain string to the specified string builder.
/// </summary>
/// <param name="builder">The string builder to append to.</param>
public void AppendTo(StringBuilder builder)
{
builder.Append(this.StringValue);
}
#endregion
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.