C#/C# Concept
[C#] 예외처리 try catch 구문
군우
2018. 5. 24. 11:12
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 | using System; using System.Collections; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication18 { class TryCatchTest { static void Main(string[] args) { string str = null; try { Console.WriteLine(str.ToString()); } catch (NullReferenceException e) { Console.WriteLine(e.ToString() ); } Console.WriteLine("프로그램을 마칩니다."); } } } | cs |