Professional Documents
Culture Documents
using System.Diagnostics;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
namespace System.Text
{
/// <summary>Represents a mutable string of characters. This class cannot be inherited.To browse th
e .NET Framework source code for this type, see the Reference Source.</summary>
// Token: 0x02000A29 RID: 2601
[ComVisible(true)]
[__DynamicallyInvokable]
[Serializable]
public sealed class StringBuilder : ISerializable
{
/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class.</su
mmary>
// Token: 0x0600657E RID: 25982 RVA: 0x001544E0 File Offset: 0x001526E0
[__DynamicallyInvokable]
public StringBuilder() : this(16)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class usin
g the specified capacity.</summary>
/// <param name="capacity">The suggested starting size of this instance. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="capacity" /> is less than zero. </exception>
// Token: 0x0600657F RID: 25983 RVA: 0x001544EA File Offset: 0x001526EA
[__DynamicallyInvokable]
public StringBuilder(int capacity) : this(string.Empty, capacity)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class usin
g the specified string.</summary>
/// <param name="value">The string used to initialize the value of the instance. If <paramref name
="value" /> is null, the new <see cref="T:System.Text.StringBuilder" /> will contain the empty string (tha
t is, it contains <see cref="F:System.String.Empty" />). </param>
// Token: 0x06006580 RID: 25984 RVA: 0x001544F8 File Offset: 0x001526F8
[__DynamicallyInvokable]
public StringBuilder(string value) : this(value, 16)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class usin
g the specified string and capacity.</summary>
/// <param name="value">The string used to initialize the value of the instance. If <paramref name
="value" /> is null, the new <see cref="T:System.Text.StringBuilder" /> will contain the empty string (tha
t is, it contains <see cref="F:System.String.Empty" />). </param>
/// <param name="capacity">The suggested starting size of the <see cref="T:System.Text.StringBuil
der" />. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="capacity" /> is less than zero. </exception>
// Token: 0x06006581 RID: 25985 RVA: 0x00154503 File Offset: 0x00152703
[__DynamicallyInvokable]
public StringBuilder(string value, int capacity) : this(value, 0, (value != null) ? value.Length : 0, capac
ity)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class fro
m the specified substring and capacity.</summary>
/// <param name="value">The string that contains the substring used to initialize the value of this i
nstance. If <paramref name="value" /> is null, the new <see cref="T:System.Text.StringBuilder" /> will c
ontain the empty string (that is, it contains <see cref="F:System.String.Empty" />). </param>
/// <param name="startIndex">The position within <paramref name="value" /> where the substrin
g begins. </param>
/// <param name="length">The number of characters in the substring. </param>
/// <param name="capacity">The suggested starting size of the <see cref="T:System.Text.StringBuil
der" />. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="capacity" /> is less than zero.-
or- <paramref name="startIndex" /> plus <paramref name="length" /> is not a position within <paramre
f name="value" />. </exception>
// Token: 0x06006582 RID: 25986 RVA: 0x0015451C File Offset: 0x0015271C
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder(string value, int startIndex, int length, int capacity)
{
if (capacity < 0)
{
throw new ArgumentOutOfRangeException("capacity", Environment.GetResourceString("Argu
mentOutOfRange_MustBePositive", new object[]
{
"capacity"
}));
}
if (length < 0)
{
throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("Argume
ntOutOfRange_MustBeNonNegNum", new object[]
{
"length"
}));
}
if (startIndex < 0)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("Arg
umentOutOfRange_StartIndex"));
}
if (value == null)
{
value = string.Empty;
}
if (startIndex > value.Length - length)
{
throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("Argume
ntOutOfRange_IndexLength"));
}
this.m_MaxCapacity = int.MaxValue;
if (capacity == 0)
{
capacity = 16;
}
if (capacity < length)
{
capacity = length;
}
this.m_ChunkChars = new char[capacity];
this.m_ChunkLength = length;
fixed (string text = value)
{
char* ptr = text;
if (ptr != null)
{
ptr += RuntimeHelpers.OffsetToStringData / 2;
}
StringBuilder.ThreadSafeCopy(ptr + startIndex, this.m_ChunkChars, 0, length);
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Text.StringBuilder" /> class that
starts with a specified capacity and can grow to a specified maximum.</summary>
/// <param name="capacity">The suggested starting size of the <see cref="T:System.Text.StringBuil
der" />. </param>
/// <param name="maxCapacity">The maximum number of characters the current string can contai
n. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="maxCapacity" /> is less than one, <paramref name="capacity" /> is less than
zero, or <paramref name="capacity" /> is greater than <paramref name="maxCapacity" />. </exception>
// Token: 0x06006583 RID: 25987 RVA: 0x00154618 File Offset: 0x00152818
[__DynamicallyInvokable]
public StringBuilder(int capacity, int maxCapacity)
{
if (capacity > maxCapacity)
{
throw new ArgumentOutOfRangeException("capacity", Environment.GetResourceString("Argu
mentOutOfRange_Capacity"));
}
if (maxCapacity < 1)
{
throw new ArgumentOutOfRangeException("maxCapacity", Environment.GetResourceString("A
rgumentOutOfRange_SmallMaxCapacity"));
}
if (capacity < 0)
{
throw new ArgumentOutOfRangeException("capacity", Environment.GetResourceString("Argu
mentOutOfRange_MustBePositive", new object[]
{
"capacity"
}));
}
if (capacity == 0)
{
capacity = Math.Min(16, maxCapacity);
}
this.m_MaxCapacity = maxCapacity;
this.m_ChunkChars = new char[capacity];
}
/// <summary>Gets or sets the maximum number of characters that can be contained in the memor
y allocated by the current instance.</summary>
/// <returns>The maximum number of characters that can be contained in the memory allocated by
the current instance. Its value can range from <see cref="P:System.Text.StringBuilder.Length" /> to <see
cref="P:System.Text.StringBuilder.MaxCapacity" />. </returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set opera
tion is less than the current length of this instance.-
or- The value specified for a set operation is greater than the maximum capacity. </exception>
// Token: 0x17001172 RID: 4466
// (get) Token: 0x06006587 RID: 25991 RVA: 0x00154860 File Offset: 0x00152A60
// (set) Token: 0x06006588 RID: 25992 RVA: 0x00154874 File Offset: 0x00152A74
[__DynamicallyInvokable]
public int Capacity
{
[__DynamicallyInvokable]
get
{
return this.m_ChunkChars.Length + this.m_ChunkOffset;
}
[__DynamicallyInvokable]
set
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value", Environment.GetResourceString("Argum
entOutOfRange_NegativeCapacity"));
}
if (value > this.MaxCapacity)
{
throw new ArgumentOutOfRangeException("value", Environment.GetResourceString("Argum
entOutOfRange_Capacity"));
}
if (value < this.Length)
{
throw new ArgumentOutOfRangeException("value", Environment.GetResourceString("Argum
entOutOfRange_SmallCapacity"));
}
if (this.Capacity != value)
{
int num = value - this.m_ChunkOffset;
char[] array = new char[num];
Array.Copy(this.m_ChunkChars, array, this.m_ChunkLength);
this.m_ChunkChars = array;
}
}
}
/// <summary>Converts the value of a substring of this instance to a <see cref="T:System.String" />.
</summary>
/// <param name="startIndex">The starting position of the substring in this instance. </param>
/// <param name="length">The length of the substring. </param>
/// <returns>A string whose value is the same as the specified substring of this instance.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="startIndex" /> or <paramref name="length" /> is less than zero.-
or- The sum of <paramref name="startIndex" /> and <paramref name="length" /> is greater than the len
gth of the current instance. </exception>
// Token: 0x0600658C RID: 25996 RVA: 0x00154A10 File Offset: 0x00152C10
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe string ToString(int startIndex, int length)
{
int length2 = this.Length;
if (startIndex < 0)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("Arg
umentOutOfRange_StartIndex"));
}
if (startIndex > length2)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("Arg
umentOutOfRange_StartIndexLargerThanLength"));
}
if (length < 0)
{
throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("Argume
ntOutOfRange_NegativeLength"));
}
if (startIndex > length2 - length)
{
throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("Argume
ntOutOfRange_IndexLength"));
}
StringBuilder stringBuilder = this;
int num = startIndex + length;
string text = string.FastAllocateString(length);
int i = length;
fixed (string text2 = text)
{
char* ptr = text2;
if (ptr != null)
{
ptr += RuntimeHelpers.OffsetToStringData / 2;
}
while (i > 0)
{
int num2 = num - stringBuilder.m_ChunkOffset;
if (num2 >= 0)
{
if (num2 > stringBuilder.m_ChunkLength)
{
num2 = stringBuilder.m_ChunkLength;
}
int num3 = i;
int num4 = num3;
int num5 = num2 - num3;
if (num5 < 0)
{
num4 += num5;
num5 = 0;
}
i -= num4;
if (num4 > 0)
{
char[] chunkChars = stringBuilder.m_ChunkChars;
if ((ulong)(num4 + i) > (ulong)((long)length) || num4 + num5 > chunkChars.Length)
{
throw new ArgumentOutOfRangeException("chunkCount", Environment.GetResource
String("ArgumentOutOfRange_Index"));
}
fixed (char* ptr2 = &chunkChars[num5])
{
string.wstrcpy(ptr + i, ptr2, num4);
}
}
}
stringBuilder = stringBuilder.m_ChunkPrevious;
}
}
return text;
}
/// <summary>Removes all characters from the current <see cref="T:System.Text.StringBuilder" /> i
nstance.</summary>
/// <returns>An object whose <see cref="P:System.Text.StringBuilder.Length" /> is 0 (zero).</return
s>
// Token: 0x0600658D RID: 25997 RVA: 0x00154B6E File Offset: 0x00152D6E
[__DynamicallyInvokable]
public StringBuilder Clear()
{
this.Length = 0;
return this;
}
/// <summary>Gets or sets the length of the current <see cref="T:System.Text.StringBuilder" /> obj
ect.</summary>
/// <returns>The length of this instance.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a set opera
tion is less than zero or greater than <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </excepti
on>
// Token: 0x17001174 RID: 4468
// (get) Token: 0x0600658E RID: 25998 RVA: 0x00154B78 File Offset: 0x00152D78
// (set) Token: 0x0600658F RID: 25999 RVA: 0x00154B88 File Offset: 0x00152D88
[__DynamicallyInvokable]
public int Length
{
[__DynamicallyInvokable]
get
{
return this.m_ChunkOffset + this.m_ChunkLength;
}
[__DynamicallyInvokable]
set
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value", Environment.GetResourceString("Argum
entOutOfRange_NegativeLength"));
}
if (value > this.MaxCapacity)
{
throw new ArgumentOutOfRangeException("value", Environment.GetResourceString("Argum
entOutOfRange_SmallCapacity"));
}
int capacity = this.Capacity;
if (value == 0 && this.m_ChunkPrevious == null)
{
this.m_ChunkLength = 0;
this.m_ChunkOffset = 0;
return;
}
int num = value - this.Length;
if (num > 0)
{
this.Append('\0', num);
return;
}
StringBuilder stringBuilder = this.FindChunkForIndex(value);
if (stringBuilder != this)
{
int num2 = capacity - stringBuilder.m_ChunkOffset;
char[] array = new char[num2];
Array.Copy(stringBuilder.m_ChunkChars, array, stringBuilder.m_ChunkLength);
this.m_ChunkChars = array;
this.m_ChunkPrevious = stringBuilder.m_ChunkPrevious;
this.m_ChunkOffset = stringBuilder.m_ChunkOffset;
}
this.m_ChunkLength = value - stringBuilder.m_ChunkOffset;
}
}
/// <summary>Gets or sets the character at the specified character position in this instance.</summ
ary>
/// <param name="index">The position of the character. </param>
/// <returns>The Unicode character at position <paramref name="index" />.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is outside the bounds of this instance while setting a character. </e
xception>
/// <exception cref="T:System.IndexOutOfRangeException">
/// <paramref name="index" /> is outside the bounds of this instance while getting a character. </
exception>
// Token: 0x17001175 RID: 4469
[__DynamicallyInvokable]
public char this[int index]
{
[__DynamicallyInvokable]
get
{
StringBuilder stringBuilder = this;
int num;
for (;;)
{
num = index - stringBuilder.m_ChunkOffset;
if (num >= 0)
{
break;
}
stringBuilder = stringBuilder.m_ChunkPrevious;
if (stringBuilder == null)
{
goto Block_3;
}
}
if (num >= stringBuilder.m_ChunkLength)
{
throw new IndexOutOfRangeException();
}
return stringBuilder.m_ChunkChars[num];
Block_3:
throw new IndexOutOfRangeException();
}
[__DynamicallyInvokable]
set
{
StringBuilder stringBuilder = this;
int num;
for (;;)
{
num = index - stringBuilder.m_ChunkOffset;
if (num >= 0)
{
break;
}
stringBuilder = stringBuilder.m_ChunkPrevious;
if (stringBuilder == null)
{
goto Block_3;
}
}
if (num >= stringBuilder.m_ChunkLength)
{
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("Argum
entOutOfRange_Index"));
}
stringBuilder.m_ChunkChars[num] = value;
return;
Block_3:
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
}
/// <summary>Appends a specified number of copies of the string representation of a Unicode char
acter to this instance.</summary>
/// <param name="value">The character to append. </param>
/// <param name="repeatCount">The number of times to append <paramref name="value" />. </p
aram>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="repeatCount" /> is less than zero.-
or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacit
y" />. </exception>
/// <exception cref="T:System.OutOfMemoryException">Out of memory.</exception>
// Token: 0x06006592 RID: 26002 RVA: 0x00154D0C File Offset: 0x00152F0C
[__DynamicallyInvokable]
public StringBuilder Append(char value, int repeatCount)
{
if (repeatCount < 0)
{
throw new ArgumentOutOfRangeException("repeatCount", Environment.GetResourceString("A
rgumentOutOfRange_NegativeCount"));
}
if (repeatCount == 0)
{
return this;
}
int num = this.m_ChunkLength;
while (repeatCount > 0)
{
if (num < this.m_ChunkChars.Length)
{
this.m_ChunkChars[num++] = value;
repeatCount--;
}
else
{
this.m_ChunkLength = num;
this.ExpandByABlock(repeatCount);
num = 0;
}
}
this.m_ChunkLength = num;
return this;
}
/// <summary>Appends the default line terminator to the end of the current <see cref="T:System.T
ext.StringBuilder" /> object.</summary>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x06006599 RID: 26009 RVA: 0x00154F87 File Offset: 0x00153187
[ComVisible(false)]
[__DynamicallyInvokable]
public StringBuilder AppendLine()
{
return this.Append(Environment.NewLine);
}
/// <summary>Appends a copy of the specified string followed by the default line terminator to the
end of the current <see cref="T:System.Text.StringBuilder" /> object.</summary>
/// <param name="value">The string to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x0600659A RID: 26010 RVA: 0x00154F94 File Offset: 0x00153194
[ComVisible(false)]
[__DynamicallyInvokable]
public StringBuilder AppendLine(string value)
{
this.Append(value);
return this.Append(Environment.NewLine);
}
/// <summary>Copies the characters from a specified segment of this instance to a specified segme
nt of a destination <see cref="T:System.Char" /> array.</summary>
/// <param name="sourceIndex">The starting position in this instance where characters will be copi
ed from. The index is zero-based.</param>
/// <param name="destination">The array where characters will be copied.</param>
/// <param name="destinationIndex">The starting position in <paramref name="destination" /> wh
ere characters will be copied. The index is zero-based.</param>
/// <param name="count">The number of characters to be copied.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="destination" /> is null.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="sourceIndex" />, <paramref name="destinationIndex" />, or <paramref nam
e="count" />, is less than zero.-or-
<paramref name="sourceIndex" /> is greater than the length of this instance.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="sourceIndex" /> + <paramref name="count" /> is greater than the length of t
his instance.-or-
<paramref name="destinationIndex" /> + <paramref name="count" /> is greater than the length of <par
amref name="destination" />.</exception>
// Token: 0x0600659B RID: 26011 RVA: 0x00154FAC File Offset: 0x001531AC
[ComVisible(false)]
[SecuritySafeCritical]
[__DynamicallyInvokable]
public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count)
{
if (destination == null)
{
throw new ArgumentNullException("destination");
}
if (count < 0)
{
throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("Arg_Ne
gativeArgCount"));
}
if (destinationIndex < 0)
{
throw new ArgumentOutOfRangeException("destinationIndex", Environment.GetResourceStrin
g("ArgumentOutOfRange_MustBeNonNegNum", new object[]
{
"destinationIndex"
}));
}
if (destinationIndex > destination.Length - count)
{
throw new ArgumentException(Environment.GetResourceString("ArgumentOutOfRange_Offset
Out"));
}
if (sourceIndex > this.Length)
{
throw new ArgumentOutOfRangeException("sourceIndex", Environment.GetResourceString("A
rgumentOutOfRange_Index"));
}
if (sourceIndex > this.Length - count)
{
throw new ArgumentException(Environment.GetResourceString("Arg_LongerThanSrcString"));
}
StringBuilder stringBuilder = this;
int num = sourceIndex + count;
int num2 = destinationIndex + count;
while (count > 0)
{
int num3 = num - stringBuilder.m_ChunkOffset;
if (num3 >= 0)
{
if (num3 > stringBuilder.m_ChunkLength)
{
num3 = stringBuilder.m_ChunkLength;
}
int num4 = count;
int num5 = num3 - count;
if (num5 < 0)
{
num4 += num5;
num5 = 0;
}
num2 -= num4;
count -= num4;
StringBuilder.ThreadSafeCopy(stringBuilder.m_ChunkChars, num5, destination, num2, num4
);
}
stringBuilder = stringBuilder.m_ChunkPrevious;
}
}
/// <summary>Inserts one or more copies of a specified string into this instance at the specified cha
racter position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The string to insert. </param>
/// <param name="count">The number of times to insert <paramref name="value" />. </param>
/// <returns>A reference to this instance after insertion has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the current length of this instance.
-or- <paramref name="count" /> is less than zero. </exception>
/// <exception cref="T:System.OutOfMemoryException">The current length of this <see cref="T:Sys
tem.Text.StringBuilder" /> object plus the length of <paramref name="value" /> times <paramref name=
"count" /> exceeds <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x0600659C RID: 26012 RVA: 0x001550C8 File Offset: 0x001532C8
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder Insert(int index, string value, int count)
{
if (count < 0)
{
throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("Argume
ntOutOfRange_NeedNonNegNum"));
}
int length = this.Length;
if (index > length)
{
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
if (value == null || value.Length == 0 || count == 0)
{
return this;
}
long num = (long)value.Length * (long)count;
if (num > (long)(this.MaxCapacity - this.Length))
{
throw new OutOfMemoryException();
}
StringBuilder stringBuilder;
int num2;
this.MakeRoom(index, (int)num, out stringBuilder, out num2, false);
fixed (string text = value)
{
char* ptr = text;
if (ptr != null)
{
ptr += RuntimeHelpers.OffsetToStringData / 2;
}
while (count > 0)
{
this.ReplaceInPlaceAtChunk(ref stringBuilder, ref num2, ptr, value.Length);
count--;
}
}
return this;
}
/// <summary>Appends the string representation of a specified Boolean value to this instance.</su
mmary>
/// <param name="value">The Boolean value to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x0600659E RID: 26014 RVA: 0x0015520D File Offset: 0x0015340D
[__DynamicallyInvokable]
public StringBuilder Append(bool value)
{
return this.Append(value.ToString());
}
/// <summary>Appends the string representation of a specified <see cref="T:System.Char" /> object
to this instance.</summary>
/// <param name="value">The UTF-16-encoded code unit to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065A1 RID: 26017 RVA: 0x00155244 File Offset: 0x00153444
[__DynamicallyInvokable]
public StringBuilder Append(char value)
{
if (this.m_ChunkLength < this.m_ChunkChars.Length)
{
char[] chunkChars = this.m_ChunkChars;
int chunkLength = this.m_ChunkLength;
this.m_ChunkLength = chunkLength + 1;
chunkChars[chunkLength] = value;
}
else
{
this.Append(value, 1);
}
return this;
}
/// <summary>Appends the string representation of a specified decimal number to this instance.</s
ummary>
/// <param name="value">The value to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065A7 RID: 26023 RVA: 0x001552EA File Offset: 0x001534EA
[__DynamicallyInvokable]
public StringBuilder Append(decimal value)
{
return this.Append(value.ToString(CultureInfo.CurrentCulture));
}
/// <summary>Appends the string representation of the Unicode characters in a specified array to t
his instance.</summary>
/// <param name="value">The array of characters to append. </param>
/// <returns>A reference to this instance after the append operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065AC RID: 26028 RVA: 0x00155350 File Offset: 0x00153550
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder Append(char[] value)
{
if (value != null && value.Length != 0)
{
fixed (char* ptr = &value[0])
{
this.Append(ptr, value.Length);
}
}
return this;
}
/// <summary>Inserts a string into this instance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The string to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the current length of this instance.
-or-
The current length of this <see cref="T:System.Text.StringBuilder" /> object plus the length of <paramref
name="value" /> exceeds <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065AD RID: 26029 RVA: 0x0015537C File Offset: 0x0015357C
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder Insert(int index, string value)
{
if (index > this.Length)
{
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
if (value != null)
{
fixed (string text = value)
{
char* ptr = text;
if (ptr != null)
{
ptr += RuntimeHelpers.OffsetToStringData / 2;
}
this.Insert(index, ptr, value.Length);
}
}
return this;
}
/// <summary>Inserts the string representation of a Boolean value into this instance at the specified
character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance.</excep
tion>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065AE RID: 26030 RVA: 0x001553CB File Offset: 0x001535CB
[__DynamicallyInvokable]
public StringBuilder Insert(int index, bool value)
{
return this.Insert(index, value.ToString(), 1);
}
/// <summary>Inserts the string representation of a specified Unicode character into this instance a
t the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance.-
or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacit
y" />. </exception>
// Token: 0x060065B2 RID: 26034 RVA: 0x0015541E File Offset: 0x0015361E
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder Insert(int index, char value)
{
this.Insert(index, &value, 1);
return this;
}
/// <summary>Inserts the string representation of a specified array of Unicode characters into this i
nstance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The character array to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance.-
or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacit
y" />. </exception>
// Token: 0x060065B3 RID: 26035 RVA: 0x0015542C File Offset: 0x0015362C
[__DynamicallyInvokable]
public StringBuilder Insert(int index, char[] value)
{
if (index > this.Length)
{
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
if (value != null)
{
this.Insert(index, value, 0, value.Length);
}
return this;
}
/// <summary>Inserts the string representation of a specified subarray of Unicode characters into t
his instance at the specified character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">A character array. </param>
/// <param name="startIndex">The starting index within <paramref name="value" />. </param>
/// <param name="charCount">The number of characters to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="value" /> is null, and <paramref name="startIndex" /> and <paramref name=
"charCount" /> are not zero. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" />, <paramref name="startIndex" />, or <paramref name="charCount
" /> is less than zero.-or- <paramref name="index" /> is greater than the length of this instance.-
or- <paramref name="startIndex" /> plus <paramref name="charCount" /> is not a position within <para
mref name="value" />.-
or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacit
y" />. </exception>
// Token: 0x060065B4 RID: 26036 RVA: 0x00155460 File Offset: 0x00153660
[SecuritySafeCritical]
[__DynamicallyInvokable]
public unsafe StringBuilder Insert(int index, char[] value, int startIndex, int charCount)
{
int length = this.Length;
if (index > length)
{
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
if (value == null)
{
if (startIndex == 0 && charCount == 0)
{
return this;
}
throw new ArgumentNullException(Environment.GetResourceString("ArgumentNull_String"));
}
else
{
if (startIndex < 0)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("A
rgumentOutOfRange_StartIndex"));
}
if (charCount < 0)
{
throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("Argu
mentOutOfRange_GenericPositive"));
}
if (startIndex > value.Length - charCount)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("A
rgumentOutOfRange_Index"));
}
if (charCount > 0)
{
fixed (char* ptr = &value[startIndex])
{
this.Insert(index, ptr, charCount);
}
}
return this;
}
}
/// <summary>Inserts the string representation of a decimal number into this instance at the specifi
ed character position.</summary>
/// <param name="index">The position in this instance where insertion begins. </param>
/// <param name="value">The value to insert. </param>
/// <returns>A reference to this instance after the insert operation has completed.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than zero or greater than the length of this instance. </exce
ption>
/// <exception cref="T:System.OutOfMemoryException">Enlarging the value of this instance would
exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />.</exception>
// Token: 0x060065B9 RID: 26041 RVA: 0x0015556E File Offset: 0x0015376E
[__DynamicallyInvokable]
public StringBuilder Insert(int index, decimal value)
{
return this.Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
}
/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
a single argument.</summary>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="arg0">An object to format. </param>
/// <returns>A reference to this instance with <paramref name="format" /> appended. Each format
item in <paramref name="format" /> is replaced by the string representation of <paramref name="arg0
" />.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid. -or-
The index of a format item is less than 0 (zero), or greater than or equal to 1.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065BE RID: 26046 RVA: 0x001555DB File Offset: 0x001537DB
[__DynamicallyInvokable]
public StringBuilder AppendFormat(string format, object arg0)
{
return this.AppendFormatHelper(null, format, new ParamsArray(arg0));
}
/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
either of two arguments.</summary>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="arg0">The first object to format. </param>
/// <param name="arg1">The second object to format. </param>
/// <returns>A reference to this instance with <paramref name="format" /> appended. Each format
item in <paramref name="format" /> is replaced by the string representation of the corresponding obje
ct argument.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid.-or-
The index of a format item is less than 0 (zero), or greater than or equal to 2. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065BF RID: 26047 RVA: 0x001555EB File Offset: 0x001537EB
[__DynamicallyInvokable]
public StringBuilder AppendFormat(string format, object arg0, object arg1)
{
return this.AppendFormatHelper(null, format, new ParamsArray(arg0, arg1));
}
/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
either of three arguments.</summary>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="arg0">The first object to format. </param>
/// <param name="arg1">The second object to format. </param>
/// <param name="arg2">The third object to format. </param>
/// <returns>A reference to this instance with <paramref name="format" /> appended. Each format
item in <paramref name="format" /> is replaced by the string representation of the corresponding obje
ct argument.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid.-or-
The index of a format item is less than 0 (zero), or greater than or equal to 3.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065C0 RID: 26048 RVA: 0x001555FC File Offset: 0x001537FC
[__DynamicallyInvokable]
public StringBuilder AppendFormat(string format, object arg0, object arg1, object arg2)
{
return this.AppendFormatHelper(null, format, new ParamsArray(arg0, arg1, arg2));
}
/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
a corresponding argument in a parameter array.</summary>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="args">An array of objects to format. </param>
/// <returns>A reference to this instance with <paramref name="format" /> appended. Each format
item in <paramref name="format" /> is replaced by the string representation of the corresponding obje
ct argument.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> or <paramref name="args" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid. -or-
The index of a format item is less than 0 (zero), or greater than or equal to the length of the <paramref n
ame="args" /> array.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065C1 RID: 26049 RVA: 0x0015560F File Offset: 0x0015380F
[__DynamicallyInvokable]
public StringBuilder AppendFormat(string format, params object[] args)
{
if (args == null)
{
throw new ArgumentNullException((format == null) ? "format" : "args");
}
return this.AppendFormatHelper(null, format, new ParamsArray(args));
}
/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
a single argument using a specified format provider. </summary>
/// <param name="provider">An object that supplies culture-
specific formatting information. </param>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="arg0">The object to format. </param>
/// <returns>A reference to this instance after the append operation has completed. After the appe
nd operation, this instance contains any data that existed before the operation, suffixed by a copy of <p
aramref name="format" /> in which any format specification is replaced by the string representation of
<paramref name="arg0" />. </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid. -or-
The index of a format item is less than 0 (zero), or greater than or equal to one (1). </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065C2 RID: 26050 RVA: 0x00155637 File Offset: 0x00153837
[__DynamicallyInvokable]
public StringBuilder AppendFormat(IFormatProvider provider, string format, object arg0)
{
return this.AppendFormatHelper(provider, format, new ParamsArray(arg0));
}
/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
either of two arguments using a specified format provider.</summary>
/// <param name="provider">An object that supplies culture-
specific formatting information. </param>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="arg0">The first object to format. </param>
/// <param name="arg1">The second object to format. </param>
/// <returns>A reference to this instance after the append operation has completed. After the appe
nd operation, this instance contains any data that existed before the operation, suffixed by a copy of <p
aramref name="format" /> where any format specification is replaced by the string representation of th
e corresponding object argument. </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid. -or-
The index of a format item is less than 0 (zero), or greater than or equal to 2 (two). </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065C3 RID: 26051 RVA: 0x00155647 File Offset: 0x00153847
[__DynamicallyInvokable]
public StringBuilder AppendFormat(IFormatProvider provider, string format, object arg0, object arg
1)
{
return this.AppendFormatHelper(provider, format, new ParamsArray(arg0, arg1));
}
/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
either of three arguments using a specified format provider.</summary>
/// <param name="provider">An object that supplies culture-
specific formatting information. </param>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="arg0">The first object to format. </param>
/// <param name="arg1">The second object to format. </param>
/// <param name="arg2">The third object to format. </param>
/// <returns>A reference to this instance after the append operation has completed. After the appe
nd operation, this instance contains any data that existed before the operation, suffixed by a copy of <p
aramref name="format" /> where any format specification is replaced by the string representation of th
e corresponding object argument. </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid. -or-
The index of a format item is less than 0 (zero), or greater than or equal to 3 (three). </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065C4 RID: 26052 RVA: 0x00155659 File Offset: 0x00153859
[__DynamicallyInvokable]
public StringBuilder AppendFormat(IFormatProvider provider, string format, object arg0, object arg
1, object arg2)
{
return this.AppendFormatHelper(provider, format, new ParamsArray(arg0, arg1, arg2));
}
/// <summary>Appends the string returned by processing a composite format string, which contains
zero or more format items, to this instance. Each format item is replaced by the string representation of
a corresponding argument in a parameter array using a specified format provider.</summary>
/// <param name="provider">An object that supplies culture-
specific formatting information. </param>
/// <param name="format">A composite format string (see Remarks). </param>
/// <param name="args">An array of objects to format.</param>
/// <returns>A reference to this instance after the append operation has completed. After the appe
nd operation, this instance contains any data that existed before the operation, suffixed by a copy of <p
aramref name="format" /> where any format specification is replaced by the string representation of th
e corresponding object argument. </returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="format" /> is null. </exception>
/// <exception cref="T:System.FormatException">
/// <paramref name="format" /> is invalid. -or-
The index of a format item is less than 0 (zero), or greater than or equal to the length of the <paramref n
ame="args" /> array.</exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">The length of the expanded string
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065C5 RID: 26053 RVA: 0x0015566D File Offset: 0x0015386D
[__DynamicallyInvokable]
public StringBuilder AppendFormat(IFormatProvider provider, string format, params object[] args)
{
if (args == null)
{
throw new ArgumentNullException((format == null) ? "format" : "args");
}
return this.AppendFormatHelper(provider, format, new ParamsArray(args));
}
/// <summary>Replaces all occurrences of a specified string in this instance with another specified s
tring.</summary>
/// <param name="oldValue">The string to replace. </param>
/// <param name="newValue">The string that replaces <paramref name="oldValue" />, or null. </p
aram>
/// <returns>A reference to this instance with all instances of <paramref name="oldValue" /> replac
ed by <paramref name="newValue" />.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="oldValue" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">The length of <paramref name="oldValue" /> is
zero. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">Enlarging the value of this instance
would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception>
// Token: 0x060065C8 RID: 26056 RVA: 0x001559CF File Offset: 0x00153BCF
[__DynamicallyInvokable]
public StringBuilder Replace(string oldValue, string newValue)
{
return this.Replace(oldValue, newValue, 0, this.Length);
}
/// <summary>Returns a value indicating whether this instance is equal to a specified object.</sum
mary>
/// <param name="sb">An object to compare with this instance, or null. </param>
/// <returns>true if this instance and <paramref name="sb" /> have equal string, <see cref="P:Syste
m.Text.StringBuilder.Capacity" />, and <see cref="P:System.Text.StringBuilder.MaxCapacity" /> values; o
therwise, false.</returns>
// Token: 0x060065C9 RID: 26057 RVA: 0x001559E0 File Offset: 0x00153BE0
[__DynamicallyInvokable]
public bool Equals(StringBuilder sb)
{
if (sb == null)
{
return false;
}
if (this.Capacity != sb.Capacity || this.MaxCapacity != sb.MaxCapacity || this.Length != sb.Length)
{
return false;
}
if (sb == this)
{
return true;
}
StringBuilder stringBuilder = this;
int i = stringBuilder.m_ChunkLength;
StringBuilder stringBuilder2 = sb;
int j = stringBuilder2.m_ChunkLength;
for (;;)
{
IL_49:
i--;
j--;
while (i < 0)
{
stringBuilder = stringBuilder.m_ChunkPrevious;
if (stringBuilder != null)
{
i = stringBuilder.m_ChunkLength + i;
}
else
{
IL_7F:
while (j < 0)
{
stringBuilder2 = stringBuilder2.m_ChunkPrevious;
if (stringBuilder2 == null)
{
break;
}
j = stringBuilder2.m_ChunkLength + j;
}
if (i < 0)
{
goto Block_8;
}
if (j < 0)
{
return false;
}
if (stringBuilder.m_ChunkChars[i] != stringBuilder2.m_ChunkChars[j])
{
return false;
}
goto IL_49;
}
}
goto IL_7F;
}
Block_8:
return j < 0;
}
/// <summary>Replaces, within a substring of this instance, all occurrences of a specified string with
another specified string.</summary>
/// <param name="oldValue">The string to replace. </param>
/// <param name="newValue">The string that replaces <paramref name="oldValue" />, or null. </p
aram>
/// <param name="startIndex">The position in this instance where the substring begins. </param>
/// <param name="count">The length of the substring. </param>
/// <returns>A reference to this instance with all instances of <paramref name="oldValue" /> replac
ed by <paramref name="newValue" /> in the range from <paramref name="startIndex" /> to <paramref
name="startIndex" /> + <paramref name="count" /> - 1.</returns>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="oldValue" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">The length of <paramref name="oldValue" /> is
zero. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="startIndex" /> or <paramref name="count" /> is less than zero.-
or- <paramref name="startIndex" /> plus <paramref name="count" /> indicates a character position not
within this instance.-
or- Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacit
y" />. </exception>
// Token: 0x060065CA RID: 26058 RVA: 0x00155A94 File Offset: 0x00153C94
[__DynamicallyInvokable]
public StringBuilder Replace(string oldValue, string newValue, int startIndex, int count)
{
int length = this.Length;
if (startIndex > length)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("Arg
umentOutOfRange_Index"));
}
if (count < 0 || startIndex > length - count)
{
throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
if (oldValue == null)
{
throw new ArgumentNullException("oldValue");
}
if (oldValue.Length == 0)
{
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "ol
dValue");
}
if (newValue == null)
{
newValue = "";
}
int num = newValue.Length - oldValue.Length;
int[] array = null;
int num2 = 0;
StringBuilder stringBuilder = this.FindChunkForIndex(startIndex);
int num3 = startIndex - stringBuilder.m_ChunkOffset;
while (count > 0)
{
if (this.StartsWith(stringBuilder, num3, count, oldValue))
{
if (array == null)
{
array = new int[5];
}
else if (num2 >= array.Length)
{
int[] array2 = new int[array.Length * 3 / 2 + 4];
Array.Copy(array, array2, array.Length);
array = array2;
}
array[num2++] = num3;
num3 += oldValue.Length;
count -= oldValue.Length;
}
else
{
num3++;
count--;
}
if (num3 >= stringBuilder.m_ChunkLength || count == 0)
{
int num4 = num3 + stringBuilder.m_ChunkOffset;
this.ReplaceAllInChunk(array, num2, stringBuilder, oldValue.Length, newValue);
num4 += (newValue.Length - oldValue.Length) * num2;
num2 = 0;
stringBuilder = this.FindChunkForIndex(num4);
num3 = num4 - stringBuilder.m_ChunkOffset;
}
}
return this;
}
/// <summary>Replaces all occurrences of a specified character in this instance with another specifi
ed character.</summary>
/// <param name="oldChar">The character to replace. </param>
/// <param name="newChar">The character that replaces <paramref name="oldChar" />. </param>
/// <returns>A reference to this instance with <paramref name="oldChar" /> replaced by <paramref
name="newChar" />.</returns>
// Token: 0x060065CB RID: 26059 RVA: 0x00155C13 File Offset: 0x00153E13
[__DynamicallyInvokable]
public StringBuilder Replace(char oldChar, char newChar)
{
return this.Replace(oldChar, newChar, 0, this.Length);
}
/// <summary>Replaces, within a substring of this instance, all occurrences of a specified character
with another specified character.</summary>
/// <param name="oldChar">The character to replace. </param>
/// <param name="newChar">The character that replaces <paramref name="oldChar" />. </param>
/// <param name="startIndex">The position in this instance where the substring begins. </param>
/// <param name="count">The length of the substring. </param>
/// <returns>A reference to this instance with <paramref name="oldChar" /> replaced by <paramref
name="newChar" /> in the range from <paramref name="startIndex" /> to <paramref name="startInde
x" /> + <paramref name="count" /> -1.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="startIndex" /> + <paramref name="count" /> is greater than the length of th
e value of this instance.-
or- <paramref name="startIndex" /> or <paramref name="count" /> is less than zero. </exception>
// Token: 0x060065CC RID: 26060 RVA: 0x00155C24 File Offset: 0x00153E24
[__DynamicallyInvokable]
public StringBuilder Replace(char oldChar, char newChar, int startIndex, int count)
{
int length = this.Length;
if (startIndex > length)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("Arg
umentOutOfRange_Index"));
}
if (count < 0 || startIndex > length - count)
{
throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("Argume
ntOutOfRange_Index"));
}
int num = startIndex + count;
StringBuilder stringBuilder = this;
for (;;)
{
int num2 = num - stringBuilder.m_ChunkOffset;
int num3 = startIndex - stringBuilder.m_ChunkOffset;
if (num2 >= 0)
{
int i = Math.Max(num3, 0);
int num4 = Math.Min(stringBuilder.m_ChunkLength, num2);
while (i < num4)
{
if (stringBuilder.m_ChunkChars[i] == oldChar)
{
stringBuilder.m_ChunkChars[i] = newChar;
}
i++;
}
}
if (num3 >= 0)
{
break;
}
stringBuilder = stringBuilder.m_ChunkPrevious;
}
return this;
}
/// <summary>Appends an array of Unicode characters starting at a specified address to this instanc
e. </summary>
/// <param name="value">A pointer to an array of characters. </param>
/// <param name="valueCount">The number of characters in the array. </param>
/// <returns>A reference to this instance after the append operation has completed. </returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="valueCount" /> is less than zero. -or-
Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity"
/>. </exception>
/// <exception cref="T:System.NullReferenceException">
/// <paramref name="value" /> is a null pointer. </exception>
// Token: 0x060065CD RID: 26061 RVA: 0x00155CDC File Offset: 0x00153EDC
[SecurityCritical]
[CLSCompliant(false)]
public unsafe StringBuilder Append(char* value, int valueCount)
{
if (valueCount < 0)
{
throw new ArgumentOutOfRangeException("valueCount", Environment.GetResourceString("Ar
gumentOutOfRange_NegativeCount"));
}
int num = valueCount + this.m_ChunkLength;
if (num <= this.m_ChunkChars.Length)
{
StringBuilder.ThreadSafeCopy(value, this.m_ChunkChars, this.m_ChunkLength, valueCount);
this.m_ChunkLength = num;
}
else
{
int num2 = this.m_ChunkChars.Length - this.m_ChunkLength;
if (num2 > 0)
{
StringBuilder.ThreadSafeCopy(value, this.m_ChunkChars, this.m_ChunkLength, num2);
this.m_ChunkLength = this.m_ChunkChars.Length;
}
int num3 = valueCount - num2;
this.ExpandByABlock(num3);
StringBuilder.ThreadSafeCopy(value + num2, this.m_ChunkChars, 0, num3);
this.m_ChunkLength = num3;
}
return this;
}