일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- HTML
- 구조체
- Python
- Data Structure
- gitlab
- jupyter
- c언어
- 깃
- 플러터
- 유니티
- 다트 언어
- 도커
- Algorithm
- github
- docker
- c# 윈폼
- Unity
- C# delegate
- Houdini
- C언어 포인터
- jupyter lab
- git
- 포인터
- C++
- c#
- vim
- c# 추상 클래스
- Flutter
- c# winform
- dart 언어
Archives
- Today
- Total
목록c# ref (1)
nomad-programmer
[Programming/C#] 참조자
C#에서 참조에 의한 매개 변수 전달은 아주 쉽다. ref 키워드만 입력해주면 된다. 물론 C++도 쉽지만... C#의 ref 키워드는 C++의 &(참조자)와 똑같은 개념이다. 매개 변수를 메소드에 참조로 전달 using System; namespace SwapRef { class MainApp { static void Swap(ref int a, ref int b) { int temp = b; b = a; a = temp; } static void Main(string[] args) { int x = 3; int y = 4; Console.WriteLine($"x:{x}, y:{y}"); Swap(ref x, ref y); Console.WriteLine($"x:{x}, y:{y}"); } } } /*..
Programming/C#
2020. 9. 7. 15:22