Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Formatters Namespace / Unsafe­String­Builder Class

UnsafeStringBuilder Class

A class similar to StringBuilder, but implemented using unsafe C#.
Inheritance Hierarchy
System.Object
  PostSharp.Patterns.Formatters.UnsafeStringBuilder

Namespace:  PostSharp.Patterns.Formatters
Assembly:  PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 5.0.51.0 (5.0.51.0)
Syntax
C#
public sealed class UnsafeStringBuilder : IDisposable

The UnsafeStringBuilder type exposes the following members.

Constructors
  NameDescription
Public methodUnsafeStringBuilder(Int32, Boolean)
Initializes a new UnsafeStringBuilder and allocates a new buffer.
Public methodUnsafeStringBuilder(Char*, Int32, Boolean)
Initializes a new UnsafeStringBuilder with a pre-allocated buffer/
Properties
  NameDescription
Public propertyBuffer
Gets a pointer to the unmanaged buffer of the current UnsafeStringBuilder.
Public propertyCapacity
Gets the capacity (number of char) of the current UnsafeStringBuilder.
Public propertyIsDisposed
Determines whether the current UnsafeStringBuilder has been disposed.
Public propertyItem
Gets the char at a given position in the current UnsafeStringBuilder.
Public propertyLength
Gets the current number of characters in the current UnsafeStringBuilder.
Public propertyThrowOnOverflow
true if an OverflowException should be thrown when the buffer capacity is insufficient, false if the Append method should return false without exception.
Public propertyVersion
Gets the version of the current UnsafeStringBuilder. This property is incremented every time the current object is reused, more specifically, when the Clear() method is called.
Methods
  NameDescription
Public methodAppend(Boolean)
Appends a Boolean (true or false, litterally) to the current UnsafeStringBuilder.
Public methodAppend(Byte)
Appends a Byte (with decimal formatting) to the current UnsafeStringBuilder.
Public methodAppend(Char)
Appends one char to the current UnsafeStringBuilder.
Public methodAppend(Char[])
Appends an array of char to the current UnsafeStringBuilder.
Public methodAppend(Int16)
Appends a Int16 (with decimal formatting) to the current UnsafeStringBuilder.
Public methodAppend(Int32)
Appends a Int32 (with decimal formatting) to the current UnsafeStringBuilder.
Public methodAppend(Int64)
Appends a Int64 (with decimal formatting) to the current UnsafeStringBuilder.
Public methodAppend(SByte)
Appends an SByte (with decimal formatting) to the current UnsafeStringBuilder.
Public methodAppend(String)
Appends a String to the current UnsafeStringBuilder.
Public methodAppend(UInt16)
Appends a UInt16 (with decimal formatting) to the current UnsafeStringBuilder.
Public methodAppend(UInt32)
Appends a UInt32 (with decimal formatting) to the current UnsafeStringBuilder.
Public methodAppend(UInt64)
Appends a UInt64 (with decimal formatting) to the current UnsafeStringBuilder.
Public methodAppend(UnsafeString)
Appends an UnsafeString to the current UnsafeStringBuilder.
Public methodAppend(UnsafeStringBuilder)
Appends the current value of a UnsafeStringBuilder to the current UnsafeStringBuilder.
Public methodAppend(Char*, Int32)
Appends an unmanaged array of char to the current UnsafeStringBuilder.
Public methodAppend(Char, Char)
Appends two char to the current UnsafeStringBuilder.
Public methodAppend(Char, Int32)
Appends several times the same char to the current UnsafeStringBuilder.
Public methodAppend(Char, Char, Char)
Appends three char to the current UnsafeStringBuilder.
Public methodAppend(Char[], Int32, Int32)
Appends an array segment of char to the current UnsafeStringBuilder.
Public methodAppend(Char, Char, Char, Char)
Appends four char to the current UnsafeStringBuilder.
Public methodAppend(Char, Char, Char, Char, Char)
Appends five char to the current UnsafeStringBuilder.
Public methodClear
Clears the current UnsafeStringBuilder so it can be reused to build a new string.
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Overrides Object.Finalize().)
Public methodSetNullTermination
Appends a null character at the end of the current string, without affecting the string length. In case of overflow, if ThrowOnOverflow is false, the last character of the string is removed and the string lenght is decreased by 1.
Public methodSubstring(Int32)
Public methodSubstring(Int32, Int32)
Public methodToString
Returns a string that represents the current object.
(Overrides Object.ToString().)
Public methodToUnsafeString
Gets an UnsafeString that provides read-only access to the current UnsafeStringBuilder.
Extension Methods
  NameDescription
Public Extension MethodQueryInterface<T>
Gets the implementation of a specified interface for the specified object.
(Defined by QueryInterfaceExtensions.)
See Also