We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd90b3e commit e252ea6Copy full SHA for e252ea6
src/MongoDB.Bson/BsonUtils.cs
@@ -117,9 +117,13 @@ public static char ToHexChar(int value)
117
/// <returns>A hex string.</returns>
118
public static string ToHexString(byte[] bytes)
119
{
120
+#if NET5_0_OR_GREATER
121
+ ArgumentNullException.ThrowIfNull(bytes);
122
+ return Convert.ToHexString(bytes).ToLowerInvariant();
123
+#else
124
if (bytes == null)
125
- throw new ArgumentNullException("bytes");
126
+ throw new ArgumentNullException(nameof(bytes));
127
}
128
129
var length = bytes.Length;
@@ -133,6 +137,7 @@ public static string ToHexString(byte[] bytes)
133
137
134
138
135
139
return new string(c);
140
+#endif
136
141
142
143
/// <summary>
0 commit comments