일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 유니티
- Data Structure
- c# winform
- 구조체
- c# 추상 클래스
- jupyter lab
- Python
- dart 언어
- 도커
- C# delegate
- C++
- c#
- vim
- 플러터
- git
- c언어
- docker
- Houdini
- 다트 언어
- github
- Flutter
- 포인터
- 깃
- gitlab
- c# 윈폼
- jupyter
- C언어 포인터
- Unity
- Algorithm
Archives
- Today
- Total
목록c# when (1)
nomad-programmer
[Programming/C#] switch 문에서 데이터 형식에 따른 조건
정수와 문자열 형식 외에도, C# 7.0부터 switch문에 데이터 형식을 조건으로 사용할 수 있게 되었다. 데이터 형식에 따라 분기할 때에는 case 절에서 데이터 형식 옆에 반드시 식별자를 붙여줘야 한다. 선언한 식별자는 case 절 안에서 사용할 수 있다. 또한 when 절을 이용하여 추가적인 조건 검사를 수행할 수 있다. when은 case 절에 붙여 사용한다. when 절을 if 문과 비슷하다고 생각하면 된다. using System; namespace CSharpExam { class SwitchExample { static int Main(string[] args) { object obj = null; string s = Console.ReadLine(); if (int.TryParse(s,..
Programming/C#
2020. 9. 6. 23:51