fork download
  1. using System;
  2.  
  3. class PruebaSwap
  4. {
  5. static void Swap(ref string a, ref string b)
  6. {
  7. string temp = a;
  8. a = b;
  9. b = temp;
  10. }
  11.  
  12. static void Main()
  13. {
  14. string x = "Juan";
  15. string y = "Oliva";
  16. Swap(ref x, ref y);
  17. Console.WriteLine(x); // Oliva
  18. Console.WriteLine(y); // Juan
  19. }
  20. }
Success #stdin #stdout 0.02s 33872KB
stdin
Standard input is empty
stdout
Oliva
Juan