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)
170
170
if ( value is string stringValue && Guid . TryParse ( stringValue , out guid ) )
171
171
return guid ;
172
172
173
- if ( value is byte [ ] bytes && bytes . Length == 16 )
173
+ if ( value is byte [ ] { Length : 16 } bytes )
174
174
return CreateGuidFromBytes ( Connection . GuidFormat , bytes ) ;
175
175
176
176
throw new InvalidCastException ( "The value could not be converted to a GUID: {0}" . FormatInvariant ( value ) ) ;
@@ -421,7 +421,7 @@ public float GetFloat(int ordinal)
421
421
// Use explicit range checks to guard against that.
422
422
return value switch
423
423
{
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." ) ) ,
425
425
decimal decimalValue => ( float ) decimalValue ,
426
426
_ => ( float ) value
427
427
} ;
Original file line number Diff line number Diff line change @@ -879,7 +879,7 @@ private async ValueTask<PayloadData> ReceiveReplyAsyncAwaited(ValueTask<ArraySeg
879
879
catch ( Exception ex )
880
880
{
881
881
SetFailed ( ex ) ;
882
- if ( ex is MySqlException msex && msex . ErrorCode == MySqlErrorCode . CommandTimeoutExpired )
882
+ if ( ex is MySqlException { ErrorCode : MySqlErrorCode . CommandTimeoutExpired } )
883
883
HandleTimeout ( ) ;
884
884
throw ;
885
885
}
@@ -1384,7 +1384,7 @@ await sslStream.AuthenticateAsClientAsync(clientAuthenticationOptions.TargetHost
1384
1384
throw new MySqlException ( MySqlErrorCode . UnableToConnectToHost , "SSL Authentication Error" , ex ) ;
1385
1385
if ( ex is IOException && clientCertificates is not null )
1386
1386
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)
1388
1388
throw new MySqlException ( MySqlErrorCode . UnableToConnectToHost , "The server doesn't support the client's specified TLS versions." , ex ) ;
1389
1389
throw ;
1390
1390
}
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public static EofPayload Create(ReadOnlySpan<byte> span)
31
31
/// <param name="payload">The payload to examine.</param>
32
32
/// <returns><c>true</c> if this is an EOF packet; otherwise, <c>false</c>.</returns>
33
33
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 ;
35
35
36
36
public const byte Signature = 0xFE ;
37
37
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ ValueTask<int> DoReadBytesSync(Memory<byte> buffer)
38
38
}
39
39
catch ( Exception ex )
40
40
{
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 } } )
42
42
return ValueTaskExtensions . FromException < int > ( MySqlException . CreateForTimeout ( ex ) ) ;
43
43
return ValueTaskExtensions . FromException < int > ( ex ) ;
44
44
}
Original file line number Diff line number Diff line change @@ -620,7 +620,7 @@ public static SslProtocols GetDefaultSslProtocols()
620
620
try
621
621
{
622
622
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 ;
624
624
}
625
625
catch ( Exception )
626
626
{
You can’t perform that action at this time.
0 commit comments