Code cleanup.

This commit is contained in:
2023-01-26 16:47:56 +08:00
parent 5e01b654bd
commit c015b60dc3

View File

@@ -18,7 +18,9 @@ namespace Cryville.Common.Buffers {
/// Creates an instance of the <see cref="TargetString" /> class.
/// </summary>
/// <param name="capacity">The initial capacity of the string.</param>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="capacity" /> is less than 0.</exception>
public TargetString(int capacity) {
if (capacity < 0) throw new ArgumentOutOfRangeException("capacity");
_arr = new char[capacity];
}
/// <summary>
@@ -49,11 +51,13 @@ namespace Cryville.Common.Buffers {
/// <summary>
/// The length of the string.
/// </summary>
/// <exception cref="ArgumentOutOfRangeException">The value specified for a set operation is less than 0.</exception>
public int Length {
get {
return m_length;
}
set {
if (Length < 0) throw new ArgumentOutOfRangeException("length");
if (m_length == value) return;
if (_arr.Length < value) {
var len = m_length;