Skip to content

Commit fa2e0ab

Browse files
committed
Use StringBuilder.Append(char) instead of (string)
CA1834: Use StringBuilder.Append(char) for single character strings https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1834
1 parent 55c816c commit fa2e0ab

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/TaglibSharp/Id3v2/Frames/AttachmentFrame.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ public override string ToString ()
506506

507507
if (string.IsNullOrEmpty (Description)) {
508508
builder.Append (Description);
509-
builder.Append (" ");
509+
builder.Append (' ');
510510
}
511511

512512
builder.AppendFormat (System.Globalization.CultureInfo.InvariantCulture, "[{0}] {1} bytes", MimeType, Data.Count);

src/TaglibSharp/Id3v2/Frames/TextIdentificationFrame.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ protected override ByteVector RenderFields (byte version)
960960
StringBuilder data = new StringBuilder ();
961961
foreach (string s in text) {
962962
if (!prev_value_indexed) {
963-
data.Append (";").Append (s);
963+
data.Append (';').Append (s);
964964
continue;
965965
}
966966

@@ -1192,7 +1192,7 @@ public override string[] Text {
11921192
/// </returns>
11931193
public override string ToString ()
11941194
{
1195-
return new StringBuilder ().Append ("[")
1195+
return new StringBuilder ().Append ('[')
11961196
.Append (Description)
11971197
.Append ("] ")
11981198
.Append (base.ToString ()).ToString ();

src/TaglibSharp/Id3v2/Frames/UrlLinkFrame.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ public override string[] Text {
677677
/// </returns>
678678
public override string ToString ()
679679
{
680-
return new StringBuilder ().Append ("[")
680+
return new StringBuilder ().Append ('[')
681681
.Append (Description)
682682
.Append ("] ")
683683
.Append (base.ToString ()).ToString ();

src/TaglibSharp/Id3v2/Tag.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -979,14 +979,14 @@ protected void Parse (ByteVector data, File file, long position, ReadStyle style
979979
if (tdat != null) {
980980
string tdat_text = tdat.ToString ();
981981
if (tdat_text.Length == 4) {
982-
tdrc_text.Append ("-").Append (tdat_text, 0, 2).Append ("-").Append (tdat_text, 2, 2);
982+
tdrc_text.Append ('-').Append (tdat_text, 0, 2).Append ('-').Append (tdat_text, 2, 2);
983983

984984
// Add the time
985985
if (time != null) {
986986
string time_text = time.ToString ();
987987

988988
if (time_text.Length == 4)
989-
tdrc_text.Append ("T").Append (time_text, 0, 2).Append (":").Append (time_text, 2, 2);
989+
tdrc_text.Append ('T').Append (time_text, 0, 2).Append (':').Append (time_text, 2, 2);
990990

991991
RemoveFrames (FrameType.TIME);
992992
}

src/TaglibSharp/Mpeg/AudioHeader.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,10 @@ public string Description {
488488
builder.Append ("MPEG Version ");
489489
switch (Version) {
490490
case Version.Version1:
491-
builder.Append ("1");
491+
builder.Append ('1');
492492
break;
493493
case Version.Version2:
494-
builder.Append ("2");
494+
builder.Append ('2');
495495
break;
496496
case Version.Version25:
497497
builder.Append ("2.5");

0 commit comments

Comments
 (0)