Skip to content

Commit 2c6c552

Browse files
committed
Added StringBuilder
1 parent dbffb0a commit 2c6c552

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

BenchmarkDotNet8/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Reflection;
2+
using System.Text;
23
using BenchmarkDotNet.Attributes;
34
using BenchmarkDotNet.Columns;
45
using BenchmarkDotNet.Jobs;
@@ -15,6 +16,9 @@ public class Benchmarks
1516
private readonly string _text1 = "Hello woRld! ThIs is a test.It CoUlD be a lot longer, but it'S not. Or is it?";
1617
private readonly string _text2 = "Hello world! This is a test.it could be a lot longer, but it's not. Or is it?";
1718

19+
[Benchmark]
20+
public string ReplaceStringBuilder() => new StringBuilder(_text1).Replace("Hello", "Goodbye").ToString();
21+
1822
[Benchmark]
1923
public bool EqualsOrdinalIgnoreCase() => _text1.Equals(_text2, StringComparison.OrdinalIgnoreCase);
2024

0 commit comments

Comments
 (0)