@@ -21,12 +21,10 @@ public void IsValid(string document)
2121 if ( cnpj . Distinct ( ) . Count ( ) == 1 )
2222 throw new InvalidCnpjException ( CnpjErrors . OnlyRepeatedDigits ) ;
2323
24- int [ ] digits = cnpj
25- . Select ( c => c - '0' )
26- . ToArray ( ) ;
24+ int [ ] digits = [ .. cnpj . Select ( c => c - '0' ) ] ;
2725
2826 // Cálculo do primeiro dígito verificador
29- int [ ] multiplier1 = { 5 , 4 , 3 , 2 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 } ;
27+ int [ ] multiplier1 = [ 5 , 4 , 3 , 2 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 ] ;
3028 int sum = 0 ;
3129
3230 for ( int i = 0 ; i < 12 ; i ++ )
@@ -39,7 +37,7 @@ public void IsValid(string document)
3937 throw new InvalidCnpjException ( CnpjErrors . Invalid ) ;
4038
4139 // Cálculo do segundo dígito verificador
42- int [ ] multiplier2 = { 6 , 5 , 4 , 3 , 2 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 } ;
40+ int [ ] multiplier2 = [ 6 , 5 , 4 , 3 , 2 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 ] ;
4341 sum = 0 ;
4442
4543 for ( int i = 0 ; i < 13 ; i ++ )
@@ -66,7 +64,7 @@ public string Sanitize(string document)
6664 }
6765
6866 public static string Format ( string document )
69- => $ "{ document . Substring ( 0 , 2 ) } .{ document . Substring ( 2 , 3 ) } .{ document . Substring ( 5 , 3 ) } /{ document . Substring ( 8 , 4 ) } -{ document . Substring ( 12 , 2 ) } ";
67+ => $ "{ document [ .. 2 ] } .{ document . Substring ( 2 , 3 ) } .{ document . Substring ( 5 , 3 ) } /{ document . Substring ( 8 , 4 ) } -{ document . Substring ( 12 , 2 ) } ";
7068
7169 #endregion
7270}
0 commit comments