Skip to content

Commit b408929

Browse files
authored
Remove redundant DbConnectionPoolKey Get Type (#512)
1 parent 7ec2095 commit b408929

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Common/src/Microsoft/Data/Common/DbConnectionPoolKey.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,12 @@ internal virtual string ConnectionString
4242

4343
public override bool Equals(object obj)
4444
{
45-
if (obj == null || obj.GetType() != typeof(DbConnectionPoolKey))
45+
if (obj == null)
4646
{
4747
return false;
4848
}
4949

50-
DbConnectionPoolKey key = obj as DbConnectionPoolKey;
51-
52-
return (key != null && _connectionString == key._connectionString);
50+
return (obj is DbConnectionPoolKey key && _connectionString == key._connectionString);
5351
}
5452

5553
public override int GetHashCode()

src/Microsoft.Data.SqlClient/netfx/src/Common/src/Microsoft/Data/Common/DbConnectionPoolKey.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,12 @@ internal virtual string ConnectionString
4343

4444
public override bool Equals(object obj)
4545
{
46-
if (obj == null || obj.GetType() != typeof(DbConnectionPoolKey))
46+
if (obj == null)
4747
{
4848
return false;
4949
}
5050

51-
DbConnectionPoolKey key = obj as DbConnectionPoolKey;
52-
53-
return (key != null && _connectionString == key._connectionString);
51+
return (obj is DbConnectionPoolKey key && _connectionString == key._connectionString);
5452
}
5553

5654
public override int GetHashCode()

0 commit comments

Comments
 (0)