@@ -131,7 +131,7 @@ public void AbortCancel(MySqlCommand command)
131131
132132 public void AddPreparedStatement ( string commandText , PreparedStatements preparedStatements )
133133 {
134- if ( m_preparedStatements == null )
134+ if ( m_preparedStatements is null )
135135 m_preparedStatements = new Dictionary < string , PreparedStatements > ( ) ;
136136 m_preparedStatements . Add ( commandText , preparedStatements ) ;
137137 }
@@ -284,7 +284,7 @@ public async Task ConnectAsync(ConnectionSettings cs, ILoadBalancer loadBalancer
284284 throw new MySqlException ( ( int ) MySqlErrorCode . UnableToConnectToHost , null , "Unable to connect to any of the specified MySQL hosts." ) ;
285285 }
286286
287- var byteHandler = m_socket != null ? ( IByteHandler ) new SocketByteHandler ( m_socket ) : new StreamByteHandler ( m_stream ) ;
287+ var byteHandler = m_socket is null ? new StreamByteHandler ( m_stream ) : ( IByteHandler ) new SocketByteHandler ( m_socket ) ;
288288 m_payloadHandler = new StandardPayloadHandler ( byteHandler ) ;
289289
290290 payload = await ReceiveAsync ( ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
@@ -352,7 +352,7 @@ public async Task ConnectAsync(ConnectionSettings cs, ILoadBalancer loadBalancer
352352 }
353353 } while ( shouldRetrySsl ) ;
354354
355- if ( m_supportsConnectionAttributes && cs . ConnectionAttributes == null )
355+ if ( m_supportsConnectionAttributes && cs . ConnectionAttributes is null )
356356 cs . ConnectionAttributes = CreateConnectionAttributes ( cs . ApplicationName ) ;
357357
358358 using ( var handshakeResponsePayload = HandshakeResponse41Payload . Create ( initialHandshake , cs , m_useCompression , m_characterSet , m_supportsConnectionAttributes ? cs . ConnectionAttributes : null ) )
@@ -394,7 +394,7 @@ public async Task<bool> TryResetConnectionAsync(ConnectionSettings cs, IOBehavio
394394 // clear all prepared statements; resetting the connection will clear them on the server
395395 ClearPreparedStatements ( ) ;
396396
397- if ( DatabaseOverride == null && ( ServerVersion . Version . CompareTo ( ServerVersions . SupportsResetConnection ) >= 0 || ServerVersion . MariaDbVersion ? . CompareTo ( ServerVersions . MariaDbSupportsResetConnection ) >= 0 ) )
397+ if ( DatabaseOverride is null && ( ServerVersion . Version . CompareTo ( ServerVersions . SupportsResetConnection ) >= 0 || ServerVersion . MariaDbVersion ? . CompareTo ( ServerVersions . MariaDbSupportsResetConnection ) >= 0 ) )
398398 {
399399 m_logArguments [ 1 ] = ServerVersion . OriginalString ;
400400 Log . Debug ( "Session{0} ServerVersion={1} supports reset connection; sending reset connection request" , m_logArguments ) ;
@@ -410,7 +410,7 @@ public async Task<bool> TryResetConnectionAsync(ConnectionSettings cs, IOBehavio
410410 else
411411 {
412412 // optimistically hash the password with the challenge from the initial handshake (supported by MariaDB; doesn't appear to be supported by MySQL)
413- if ( DatabaseOverride == null )
413+ if ( DatabaseOverride is null )
414414 {
415415 m_logArguments [ 1 ] = ServerVersion . OriginalString ;
416416 Log . Debug ( "Session{0} ServerVersion={1} doesn't support reset connection; sending change user request" , m_logArguments ) ;
@@ -918,7 +918,7 @@ private async Task InitSslAsync(ProtocolCapabilities serverCapabilities, Connect
918918 var store = new X509Store ( StoreName . My , storeLocation ) ;
919919 store . Open ( OpenFlags . ReadOnly | OpenFlags . OpenExistingOnly ) ;
920920
921- if ( cs . CertificateThumbprint == null )
921+ if ( cs . CertificateThumbprint is null )
922922 {
923923 if ( store . Certificates . Count == 0 )
924924 {
@@ -1064,11 +1064,8 @@ bool ValidateRemoteCertificate(object rcbSender, X509Certificate rcbCertificate,
10641064 return rcbPolicyErrors == SslPolicyErrors . None ;
10651065 }
10661066
1067- SslStream sslStream ;
1068- if ( clientCertificates == null )
1069- sslStream = new SslStream ( m_stream , false , ValidateRemoteCertificate ) ;
1070- else
1071- sslStream = new SslStream ( m_stream , false , ValidateRemoteCertificate , ValidateLocalCertificate ) ;
1067+ var sslStream = clientCertificates is null ? new SslStream ( m_stream , false , ValidateRemoteCertificate ) :
1068+ new SslStream ( m_stream , false , ValidateRemoteCertificate , ValidateLocalCertificate ) ;
10721069
10731070 var checkCertificateRevocation = cs . SslMode == MySqlSslMode . VerifyFull ;
10741071
0 commit comments