<PackageReference Include="Namotion.Reflection" Version="3.1.0" />

StringBuilderExtensions

Contains extension for StringBuilder.
using System.Runtime.CompilerServices; using System.Text; namespace Namotion.Reflection { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] internal static class StringBuilderExtensions { public static StringBuilder Append(this StringBuilder stringBuilder, [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 2 })] params string[] values) { foreach (string value in values) { if (!string.IsNullOrEmpty(value)) stringBuilder.Append(value); } return stringBuilder; } [System.Runtime.CompilerServices.NullableContext(2)] [return: System.Runtime.CompilerServices.Nullable(1)] public static StringBuilder Append([System.Runtime.CompilerServices.Nullable(1)] this StringBuilder stringBuilder, string value1, string value2, string value3 = null, string value4 = null, string value5 = null, string value6 = null) { AppendStringToStringBuilder(stringBuilder, value1); AppendStringToStringBuilder(stringBuilder, value2); AppendStringToStringBuilder(stringBuilder, value3); AppendStringToStringBuilder(stringBuilder, value4); AppendStringToStringBuilder(stringBuilder, value5); AppendStringToStringBuilder(stringBuilder, value6); return stringBuilder; } private static void AppendStringToStringBuilder(StringBuilder stringBuilder, [System.Runtime.CompilerServices.Nullable(2)] string value) { if (!string.IsNullOrEmpty(value)) stringBuilder.Append(value); } } }