Pregunta de entrevista de Tech Mahindra

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

Respuesta de la entrevista

Anónimo

17 abr 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).