1- // Licensed to the .NET Foundation under one or more agreements.
1+ // Licensed to the .NET Foundation under one or more agreements.
22// The .NET Foundation licenses this file to you under the MIT license.
33
44using System . Runtime . CompilerServices ;
@@ -479,9 +479,7 @@ public static float ToSingle(string value)
479479 /// <returns>The String representation, in base 64, of the contents of <paramref name="inArray"/>.</returns>
480480 public static string ToBase64String ( byte [ ] inArray )
481481 {
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 ) ;
485483
486484 return ToBase64String ( inArray , 0 , inArray . Length , Base64FormattingOptions . None ) ;
487485 }
@@ -494,9 +492,7 @@ public static string ToBase64String(byte[] inArray)
494492 /// <returns>The string representation in base 64 of the elements in <paramref name="inArray"/>.</returns>
495493 public static String ToBase64String ( byte [ ] inArray , Base64FormattingOptions options )
496494 {
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 ) ;
500496
501497 return ToBase64String ( inArray , 0 , inArray . Length , options ) ;
502498 }
@@ -523,10 +519,9 @@ public static String ToBase64String(byte[] inArray, int offset, int length)
523519 /// <returns>The string representation in base 64 of <paramref name="length"/> elements of <paramref name="inArray"/>, starting at position <paramref name="offset"/>.</returns>
524520 public static string ToBase64String ( byte [ ] inArray , int offset , int length , Base64FormattingOptions options )
525521 {
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+
530525#pragma warning disable S3928 // Parameter names used into ArgumentException constructors should match an existing one
531526 if ( length < 0 ) throw new ArgumentOutOfRangeException ( ) ;
532527#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
564559 /// <returns>An array of 8-bit unsigned integers equivalent to <paramref name="length"/> elements at position <paramref name="offset"/> in <paramref name="inArray"/>.</returns>
565560 public static byte [ ] FromBase64CharArray ( char [ ] inArray , int offset , int length )
566561 {
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+
570564#pragma warning disable S3928 // Parameter names used into ArgumentException constructors should match an existing one
571565 if ( length < 0 ) throw new ArgumentOutOfRangeException ( ) ;
572566#pragma warning restore S3928 // Parameter names used into ArgumentException constructors should match an existing one
0 commit comments