
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 | using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NewExceptionTest { class NewExceptionTest { static void Main(string[] args) { Console.WriteLine("1. Start"); try { throw new BadImageFormatException(); // err } catch(Exception e) { Console.WriteLine("2. 예외 정보 출력"); Console.WriteLine(e); } Console.WriteLine("3.종료"); } } } | cs |
throw는 사용자가 직접 예외를 만들어서 발생시킬 때 사용하는 키워드.
'C# > C# Concept' 카테고리의 다른 글
[C#] 스트림 (0) | 2018.06.07 |
---|---|
[C#] 사용자 예외처리 (0) | 2018.05.31 |
[C#] 예외 처리 finally (0) | 2018.05.31 |
[C#] 다중 catch (0) | 2018.05.31 |
[C#] 예외처리 try catch 구문 (0) | 2018.05.24 |