1
- // Licensed to the .NET Foundation under one or more agreements.
1
+ // Licensed to the .NET Foundation under one or more agreements.
2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
4
using System . Runtime . CompilerServices ;
@@ -479,9 +479,7 @@ public static float ToSingle(string value)
479
479
/// <returns>The String representation, in base 64, of the contents of <paramref name="inArray"/>.</returns>
480
480
public static string ToBase64String ( byte [ ] inArray )
481
481
{
482
- #pragma warning disable S3928 // Parameter names used into ArgumentException constructors should match an existing one
483
- if ( inArray == null ) throw new ArgumentNullException ( ) ;
484
- #pragma warning restore S3928 // Parameter names used into ArgumentException constructors should match an existing one
482
+ ArgumentNullException . ThrowIfNull ( inArray ) ;
485
483
486
484
return ToBase64String ( inArray , 0 , inArray . Length , Base64FormattingOptions . None ) ;
487
485
}
@@ -494,9 +492,7 @@ public static string ToBase64String(byte[] inArray)
494
492
/// <returns>The string representation in base 64 of the elements in <paramref name="inArray"/>.</returns>
495
493
public static String ToBase64String ( byte [ ] inArray , Base64FormattingOptions options )
496
494
{
497
- #pragma warning disable S3928 // Parameter names used into ArgumentException constructors should match an existing one
498
- if ( inArray == null ) throw new ArgumentNullException ( ) ;
499
- #pragma warning restore S3928 // Parameter names used into ArgumentException constructors should match an existing one
495
+ ArgumentNullException . ThrowIfNull ( inArray ) ;
500
496
501
497
return ToBase64String ( inArray , 0 , inArray . Length , options ) ;
502
498
}
@@ -523,10 +519,9 @@ public static String ToBase64String(byte[] inArray, int offset, int length)
523
519
/// <returns>The string representation in base 64 of <paramref name="length"/> elements of <paramref name="inArray"/>, starting at position <paramref name="offset"/>.</returns>
524
520
public static string ToBase64String ( byte [ ] inArray , int offset , int length , Base64FormattingOptions options )
525
521
{
526
- //Do data verfication
527
- #pragma warning disable S3928 // Parameter names used into ArgumentException constructors should match an existing one
528
- if ( inArray == null ) throw new ArgumentNullException ( ) ;
529
- #pragma warning restore S3928 // Parameter names used into ArgumentException constructors should match an existing one
522
+ // Do data verfication
523
+ ArgumentNullException . ThrowIfNull ( inArray ) ;
524
+
530
525
#pragma warning disable S3928 // Parameter names used into ArgumentException constructors should match an existing one
531
526
if ( length < 0 ) throw new ArgumentOutOfRangeException ( ) ;
532
527
#pragma warning restore S3928 // Parameter names used into ArgumentException constructors should match an existing one
@@ -564,9 +559,8 @@ public static string ToBase64String(byte[] inArray, int offset, int length, Base
564
559
/// <returns>An array of 8-bit unsigned integers equivalent to <paramref name="length"/> elements at position <paramref name="offset"/> in <paramref name="inArray"/>.</returns>
565
560
public static byte [ ] FromBase64CharArray ( char [ ] inArray , int offset , int length )
566
561
{
567
- #pragma warning disable S3928 // Parameter names used into ArgumentException constructors should match an existing one
568
- if ( inArray == null ) throw new ArgumentNullException ( ) ;
569
- #pragma warning restore S3928 // Parameter names used into ArgumentException constructors should match an existing one
562
+ ArgumentNullException . ThrowIfNull ( inArray ) ;
563
+
570
564
#pragma warning disable S3928 // Parameter names used into ArgumentException constructors should match an existing one
571
565
if ( length < 0 ) throw new ArgumentOutOfRangeException ( ) ;
572
566
#pragma warning restore S3928 // Parameter names used into ArgumentException constructors should match an existing one
0 commit comments