Case A
Here x and y become scalar variables of values 0 each.
if ((0, 0) is (int x, int y))
{
Console.WriteLine($"{x + y}");
}
if ((object)(0, 0) is (int x, int y))
{
Console.WriteLine($"{x + y}");
}
Case B
The following is compilable but I don't understand what p is for.
x, y are scalar variables and p is a tuple with fields Item1 and Item2 (rather than x and y).
if ((0, 0) is (int x, int y) p)
{
Console.WriteLine($"{x + y} and {p.Item1 + p.Item2}");
}
And the following does not compile due to the existence of p.
if ((object)(0, 0) is (int x, int y) p)
{
Console.WriteLine($"{x + y} and {p.Item1 + p.Item2}");
}
