Skip to content

Commit 644951e

Browse files
Joy-lesslinkdotnet
authored andcommitted
Add IsEmpty
1 parent d17de58 commit 644951e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/LinkDotNet.StringBuilder/ValueStringBuilder.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Buffers;
1+
using System.Buffers;
22
using System.Runtime.CompilerServices;
33
using System.Runtime.InteropServices;
44

@@ -85,6 +85,18 @@ public readonly int Capacity
8585
get => buffer.Length;
8686
}
8787

88+
/// <summary>
89+
/// Gets a value indicating whether the builder's length is 0.
90+
/// </summary>
91+
/// <value>
92+
/// <see langword="true"/> if the builder is empty; otherwise, <see langword="false"/>.
93+
/// </value>
94+
public readonly bool IsEmpty
95+
{
96+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
97+
get => Length == 0;
98+
}
99+
88100
/// <summary>
89101
/// Returns the character at the given index or throws an <see cref="IndexOutOfRangeException"/> if the index is bigger than the string.
90102
/// </summary>

0 commit comments

Comments
 (0)