/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
docs/csharp/snippets/methods/swap107.cs
21 строка
433 B
Bill Wagner
Add params collections (#40978)
21 май 2024, 00:01
Не верифицирован
21 май 2024, 00:01
57cbe8e
Код
Авторство
О чём код?
// <Snippet107> public static class RefSwapExample { static void Main() { int i = 2, j = 3; Console.WriteLine("i = {0} j = {1}", i, j); Swap(ref i, ref j); Console.WriteLine("i = {0} j = {1}", i, j); } static void Swap(ref int x, ref int y) => (y, x) = (x, y); } // The example displays the following output: // i = 2 j = 3 // i = 3 j = 2 // </Snippet107>