File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -464,19 +464,17 @@ internal static string IPAddressPreferenceToString(SqlConnectionIPAddressPrefere
464464
465465 internal static SqlConnectionIPAddressPreference ConvertToIPAddressPreference ( string keyword , object value )
466466 {
467- if ( null == value )
467+ if ( value is null )
468468 {
469469 return DbConnectionStringDefaults . IPAddressPreference ; // IPv4First
470470 }
471471
472472 string sValue = ( value as string ) ;
473- SqlConnectionIPAddressPreference result ;
474-
475- if ( null != sValue )
473+ if ( sValue is not null )
476474 {
477475 // try again after remove leading & trailing whitespaces.
478476 sValue = sValue . Trim ( ) ;
479- if ( TryConvertToIPAddressPreference ( sValue , out result ) )
477+ if ( TryConvertToIPAddressPreference ( sValue , out SqlConnectionIPAddressPreference result ) )
480478 {
481479 return result ;
482480 }
@@ -489,9 +487,9 @@ internal static SqlConnectionIPAddressPreference ConvertToIPAddressPreference(st
489487 // the value is not string, try other options
490488 SqlConnectionIPAddressPreference eValue ;
491489
492- if ( value is SqlConnectionIPAddressPreference )
490+ if ( value is SqlConnectionIPAddressPreference preference )
493491 {
494- eValue = ( SqlConnectionIPAddressPreference ) value ;
492+ eValue = preference ;
495493 }
496494 else if ( value . GetType ( ) . IsEnum )
497495 {
Original file line number Diff line number Diff line change @@ -396,11 +396,7 @@ internal SqlConnectionAttestationProtocol AttestationProtocol
396396 /// </summary>
397397 internal SqlConnectionIPAddressPreference iPAddressPreference
398398 {
399- get
400- {
401- SqlConnectionString opt = ( SqlConnectionString ) ConnectionOptions ;
402- return opt . IPAddressPreference ;
403- }
399+ get => ( ( SqlConnectionString ) ConnectionOptions ) . IPAddressPreference ;
404400 }
405401
406402 // This method will be called once connection string is set or changed.
You can’t perform that action at this time.
0 commit comments