Skip to content

Commit 283a11d

Browse files
Fix collection intializer null-ref.
1 parent 63f69a6 commit 283a11d

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Source/Extensions._.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ namespace Open.Text;
77
public static partial class TextExtensions
88
{
99
private const uint BYTE_RED = 1024;
10-
private static readonly string[] _byte_labels = ["KB", "MB", "GB", "TB", "PB"];
11-
private static readonly string[] _number_labels = ["K", "M", "B"];
10+
[SuppressMessage("Style",
11+
"IDE0300:Simplify collection initialization",
12+
Justification = "Can cause NullReferenceException when initializing a static class.")]
13+
private static readonly string[] _byte_labels = new[] { "KB", "MB", "GB", "TB", "PB" };
14+
[SuppressMessage("Style",
15+
"IDE0300:Simplify collection initialization",
16+
Justification = "Can cause NullReferenceException when initializing a static class.")]
17+
private static readonly string[] _number_labels = new[] { "K", "M", "B" };
1218

1319
/// <summary>
1420
/// Compiled pattern for finding alpha-numeric sequences.

0 commit comments

Comments
 (0)