File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed
src/LinkDotNet.StringBuilder
tests/LinkDotNet.StringBuilder.UnitTests Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ All notable changes to **ValueStringBuilder** will be documented in this file. T
66
77## [ Unreleased]
88
9+ ### Addeed
10+
11+ - Added overload which allows an initial string for the ValueStringBuilder
12+
913## [ 1.5.1] - 2022-11-05
1014
1115### Added
Original file line number Diff line number Diff line change @@ -41,6 +41,17 @@ public ValueStringBuilder(Span<char> initialBuffer)
4141 arrayFromPool = null ;
4242 }
4343
44+ /// <summary>
45+ /// Initializes a new instance of the <see cref="ValueStringBuilder"/> struct.
46+ /// </summary>
47+ /// <param name="initialText">The initial text used to initialize this instance. If <paramref name="initialText"/> is <c>null</c>
48+ /// the <see cref="ValueStringBuilder"/> will return an empty string (<see cref="string.Empty"/>).
49+ /// </param>
50+ public ValueStringBuilder ( ReadOnlySpan < char > initialText)
51+ {
52+ Append ( initialText ) ;
53+ }
54+
4455 /// <summary>
4556 /// Gets the current length of the represented string.
4657 /// </summary>
Original file line number Diff line number Diff line change @@ -384,4 +384,12 @@ public void ConcatDifferentTypesWithFiveArguments()
384384
385385 result . Should ( ) . Be ( "Test1234" ) ;
386386 }
387+
388+ [ Fact ]
389+ public void ShouldAcceptInitialCharBuffer ( )
390+ {
391+ var result = new ValueStringBuilder ( "Hello World" ) . ToString ( ) ;
392+
393+ result . Should ( ) . Be ( "Hello World" ) ;
394+ }
387395}
You can’t perform that action at this time.
0 commit comments