Skip to content

Commit 62f3094

Browse files
fix: Update src/NetEvolve.CodeBuilder/CSharpCodeBuilder.Append.cs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Martin Stühmer <me@samtrion.net>
1 parent fe00a0e commit 62f3094

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/NetEvolve.CodeBuilder/CSharpCodeBuilder.Append.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,19 +206,21 @@ public CSharpCodeBuilder Append(ReadOnlySpan<char> value)
206206
/// <remarks>If the span is empty, the method returns without appending anything.</remarks>
207207
public CSharpCodeBuilder Append(ReadOnlySpan<char> value, int startIndex, int count)
208208
{
209-
if (value.IsEmpty)
209+
var slice = value.Slice(startIndex, count);
210+
if (slice.IsEmpty)
210211
{
211212
return this;
212213
}
213214

214215
EnsureIndented();
215-
#if NETSTANDARD2_0
216-
_ = _builder.Append(value.Slice(startIndex, count).ToString());
217-
#else
218-
_ = _builder.Append(value.Slice(startIndex, count));
219-
#endif
216+
`#if` NETSTANDARD2_0
217+
_ = _builder.Append(slice.ToString());
218+
`#else`
219+
_ = _builder.Append(slice);
220+
`#endif`
220221
return this;
221222
}
223+
}
222224

223225
/// <summary>
224226
/// Appends a subset of a string to the current builder.

0 commit comments

Comments
 (0)