From f303eef07e4c4eb9a2d6d55f63a58a5d0fb510c2 Mon Sep 17 00:00:00 2001
From: Joyless <65855333+Joy-less@users.noreply.github.com>
Date: Sat, 3 May 2025 14:55:45 +0100
Subject: [PATCH] Add `IsEmpty`
---
src/LinkDotNet.StringBuilder/ValueStringBuilder.cs | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/LinkDotNet.StringBuilder/ValueStringBuilder.cs b/src/LinkDotNet.StringBuilder/ValueStringBuilder.cs
index 0f1fcb7..e7f4842 100644
--- a/src/LinkDotNet.StringBuilder/ValueStringBuilder.cs
+++ b/src/LinkDotNet.StringBuilder/ValueStringBuilder.cs
@@ -1,4 +1,4 @@
-using System.Buffers;
+using System.Buffers;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -85,6 +85,18 @@ public readonly int Capacity
get => buffer.Length;
}
+ ///
+ /// Gets a value indicating whether the builder's length is 0.
+ ///
+ ///
+ /// if the builder is empty; otherwise, .
+ ///
+ public readonly bool IsEmpty
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get => Length == 0;
+ }
+
///
/// Returns the character at the given index or throws an if the index is bigger than the string.
///