summaryrefslogtreecommitdiff
path: root/src/System.Private.CoreLib/shared/System/Tuple.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/Tuple.cs')
-rw-r--r--src/System.Private.CoreLib/shared/System/Tuple.cs64
1 files changed, 16 insertions, 48 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Tuple.cs b/src/System.Private.CoreLib/shared/System/Tuple.cs
index ebbd156dda..bb72e4f0ec 100644
--- a/src/System.Private.CoreLib/shared/System/Tuple.cs
+++ b/src/System.Private.CoreLib/shared/System/Tuple.cs
@@ -124,9 +124,7 @@ namespace System
{
if (other == null) return false;
- Tuple<T1> objTuple = other as Tuple<T1>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1> objTuple))
{
return false;
}
@@ -143,9 +141,7 @@ namespace System
{
if (other == null) return 1;
- Tuple<T1> objTuple = other as Tuple<T1>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1> objTuple))
{
throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), nameof(other));
}
@@ -227,9 +223,7 @@ namespace System
{
if (other == null) return false;
- Tuple<T1, T2> objTuple = other as Tuple<T1, T2>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1, T2> objTuple))
{
return false;
}
@@ -246,9 +240,7 @@ namespace System
{
if (other == null) return 1;
- Tuple<T1, T2> objTuple = other as Tuple<T1, T2>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1, T2> objTuple))
{
throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), nameof(other));
}
@@ -345,9 +337,7 @@ namespace System
{
if (other == null) return false;
- Tuple<T1, T2, T3> objTuple = other as Tuple<T1, T2, T3>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1, T2, T3> objTuple))
{
return false;
}
@@ -364,9 +354,7 @@ namespace System
{
if (other == null) return 1;
- Tuple<T1, T2, T3> objTuple = other as Tuple<T1, T2, T3>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1, T2, T3> objTuple))
{
throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), nameof(other));
}
@@ -474,9 +462,7 @@ namespace System
{
if (other == null) return false;
- Tuple<T1, T2, T3, T4> objTuple = other as Tuple<T1, T2, T3, T4>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1, T2, T3, T4> objTuple))
{
return false;
}
@@ -493,9 +479,7 @@ namespace System
{
if (other == null) return 1;
- Tuple<T1, T2, T3, T4> objTuple = other as Tuple<T1, T2, T3, T4>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1, T2, T3, T4> objTuple))
{
throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), nameof(other));
}
@@ -614,9 +598,7 @@ namespace System
{
if (other == null) return false;
- Tuple<T1, T2, T3, T4, T5> objTuple = other as Tuple<T1, T2, T3, T4, T5>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1, T2, T3, T4, T5> objTuple))
{
return false;
}
@@ -633,9 +615,7 @@ namespace System
{
if (other == null) return 1;
- Tuple<T1, T2, T3, T4, T5> objTuple = other as Tuple<T1, T2, T3, T4, T5>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1, T2, T3, T4, T5> objTuple))
{
throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), nameof(other));
}
@@ -765,9 +745,7 @@ namespace System
{
if (other == null) return false;
- Tuple<T1, T2, T3, T4, T5, T6> objTuple = other as Tuple<T1, T2, T3, T4, T5, T6>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1, T2, T3, T4, T5, T6> objTuple))
{
return false;
}
@@ -784,9 +762,7 @@ namespace System
{
if (other == null) return 1;
- Tuple<T1, T2, T3, T4, T5, T6> objTuple = other as Tuple<T1, T2, T3, T4, T5, T6>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1, T2, T3, T4, T5, T6> objTuple))
{
throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), nameof(other));
}
@@ -927,9 +903,7 @@ namespace System
{
if (other == null) return false;
- Tuple<T1, T2, T3, T4, T5, T6, T7> objTuple = other as Tuple<T1, T2, T3, T4, T5, T6, T7>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1, T2, T3, T4, T5, T6, T7> objTuple))
{
return false;
}
@@ -946,9 +920,7 @@ namespace System
{
if (other == null) return 1;
- Tuple<T1, T2, T3, T4, T5, T6, T7> objTuple = other as Tuple<T1, T2, T3, T4, T5, T6, T7>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1, T2, T3, T4, T5, T6, T7> objTuple))
{
throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), nameof(other));
}
@@ -1105,9 +1077,7 @@ namespace System
{
if (other == null) return false;
- Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> objTuple = other as Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> objTuple))
{
return false;
}
@@ -1124,9 +1094,7 @@ namespace System
{
if (other == null) return 1;
- Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> objTuple = other as Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>;
-
- if (objTuple == null)
+ if (!(other is Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> objTuple))
{
throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), nameof(other));
}