How to Test if C# ref Arguments Reference the Same Item

Viewed 228

In C# given a function with the below signature

public static void Foo(ref int x, ref int y)

If the function was called using

int A = 10;
Foo(ref A, ref A)

Inside the function Foo is it possible to test that the x and y arguments reference the same variable? A simple equivalent test of x and y isn't sufficient as this is also true in the case two different variable have the same value.

2 Answers
Related