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