> 'StringBuilderで文字列を追加していく > Dim sw3 As New System.Diagnostics.Stopwatch() > sw3.Start() > For i As Integer = 0 To 1000000 > Dim sb As New System.Text.StringBuilder() > For ai As Integer = 0 To appendCount - 1 > sb.Append(s1) > Next > Dim r3 As String = sb.ToString() > Next > sw3.Stop()
'StringBuilderで文字列を追加していく Dim sw3 As New System.Diagnostics.Stopwatch() Dim sb As New System.Text.StringBuilder() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sw3.Start() For i As Integer = 0 To 1000000 sb.Clear() ~~~~~~~~~~ For ai As Integer = 0 To appendCount - 1 sb.Append(s1) Next Dim r3 As String = sb.ToString() Next sw3.Stop()
管理人 2018/07/4 (Wed) 02:12:12
その通りですが、ここでは連結演算子との比較が目的ですので、このようになっています。