Advertisement
MustyElbow

SwapVariables

Aug 26th, 2023
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace SwapVariables
  8. {
  9.     internal class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string name = "Samoylov";
  14.             string surname = "Dmitry";
  15.  
  16.             Console.WriteLine($"{name} {surname}");
  17.  
  18.             (name, surname) = (surname, name);
  19.             Console.WriteLine($"{name} {surname}");
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement