Frage im Vorstellungsgespräch bei Tech Mahindra

In C# how would you swop the values in two variables without using a third variable.

Antwort im Vorstellungsgespräch

Anonym

17. Apr. 2025

In C# how would you swop the values in two variables without using a third variable. I combined the values of the two variables into the second variables and used indexof with a delimitator to get the first variable value. While it would work it wasn't what the interviewer was looking for. CORRECT ANSWER: TUPLE SWAP (a, b)=(b,a).