
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 |
'C# > C# Concept' 카테고리의 다른 글
[C#] 예외 처리 finally (0) | 2018.05.31 |
---|---|
[C#] 다중 catch (0) | 2018.05.31 |
[C#] NameValueCollection 클래스 (0) | 2018.05.24 |
[C#] Stack (0) | 2018.05.24 |
[C#] Hashtable 클래스 (0) | 2018.05.24 |