File tree Expand file tree Collapse file tree 5 files changed +7
-7
lines changed Expand file tree Collapse file tree 5 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ public Guid GetGuid(int ordinal)
170170 if ( value is string stringValue && Guid . TryParse ( stringValue , out guid ) )
171171 return guid ;
172172
173- if ( value is byte [ ] bytes && bytes . Length == 16 )
173+ if ( value is byte [ ] { Length : 16 } bytes )
174174 return CreateGuidFromBytes ( Connection . GuidFormat , bytes ) ;
175175
176176 throw new InvalidCastException ( "The value could not be converted to a GUID: {0}" . FormatInvariant ( value ) ) ;
@@ -421,7 +421,7 @@ public float GetFloat(int ordinal)
421421 // Use explicit range checks to guard against that.
422422 return value switch
423423 {
424- double doubleValue => ( doubleValue >= float . MinValue && doubleValue <= float . MaxValue ? ( float ) doubleValue : throw new InvalidCastException ( "The value cannot be safely cast to Single." ) ) ,
424+ double doubleValue => ( doubleValue is >= float . MinValue and <= float . MaxValue ? ( float ) doubleValue : throw new InvalidCastException ( "The value cannot be safely cast to Single." ) ) ,
425425 decimal decimalValue => ( float ) decimalValue ,
426426 _ => ( float ) value
427427 } ;
Original file line number Diff line number Diff line change @@ -879,7 +879,7 @@ private async ValueTask<PayloadData> ReceiveReplyAsyncAwaited(ValueTask<ArraySeg
879879 catch ( Exception ex )
880880 {
881881 SetFailed ( ex ) ;
882- if ( ex is MySqlException msex && msex . ErrorCode == MySqlErrorCode . CommandTimeoutExpired )
882+ if ( ex is MySqlException { ErrorCode : MySqlErrorCode . CommandTimeoutExpired } )
883883 HandleTimeout ( ) ;
884884 throw ;
885885 }
@@ -1384,7 +1384,7 @@ await sslStream.AuthenticateAsClientAsync(clientAuthenticationOptions.TargetHost
13841384 throw new MySqlException ( MySqlErrorCode . UnableToConnectToHost , "SSL Authentication Error" , ex ) ;
13851385 if ( ex is IOException && clientCertificates is not null )
13861386 throw new MySqlException ( MySqlErrorCode . UnableToConnectToHost , "MySQL Server rejected client certificate" , ex ) ;
1387- if ( ex is Win32Exception win32 && win32 . NativeErrorCode == - 2146893007 ) // SEC_E_ALGORITHM_MISMATCH (0x80090331)
1387+ if ( ex is Win32Exception { NativeErrorCode : - 2146893007 } ) // SEC_E_ALGORITHM_MISMATCH (0x80090331)
13881388 throw new MySqlException ( MySqlErrorCode . UnableToConnectToHost , "The server doesn't support the client's specified TLS versions." , ex ) ;
13891389 throw ;
13901390 }
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public static EofPayload Create(ReadOnlySpan<byte> span)
3131 /// <param name="payload">The payload to examine.</param>
3232 /// <returns><c>true</c> if this is an EOF packet; otherwise, <c>false</c>.</returns>
3333 public static bool IsEof ( PayloadData payload ) =>
34- payload . Span . Length > 0 && payload . Span . Length < 9 && payload . HeaderByte == Signature ;
34+ payload . Span . Length is > 0 and < 9 && payload . HeaderByte == Signature ;
3535
3636 public const byte Signature = 0xFE ;
3737
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ ValueTask<int> DoReadBytesSync(Memory<byte> buffer)
3838 }
3939 catch ( Exception ex )
4040 {
41- if ( RemainingTimeout != Constants . InfiniteTimeout && ex is IOException ioException && ioException . InnerException is SocketException socketException && socketException . SocketErrorCode == SocketError . TimedOut )
41+ if ( RemainingTimeout != Constants . InfiniteTimeout && ex is IOException { InnerException : SocketException { SocketErrorCode : SocketError . TimedOut } } )
4242 return ValueTaskExtensions . FromException < int > ( MySqlException . CreateForTimeout ( ex ) ) ;
4343 return ValueTaskExtensions . FromException < int > ( ex ) ;
4444 }
Original file line number Diff line number Diff line change @@ -620,7 +620,7 @@ public static SslProtocols GetDefaultSslProtocols()
620620 try
621621 {
622622 var property = typeof ( ServicePointManager ) . GetProperty ( "DisableSystemDefaultTlsVersions" , BindingFlags . NonPublic | BindingFlags . Static ) ;
623- disableSystemDefaultTlsVersions = property is null || ( property . GetValue ( null ) is bool b && b ) ;
623+ disableSystemDefaultTlsVersions = property is null || property . GetValue ( null ) is true ;
624624 }
625625 catch ( Exception )
626626 {
You can’t perform that action at this time.
0 commit comments