diff --git a/Exceptionhandling/Exceptionhandling.csproj b/Exceptionhandling/Exceptionhandling.csproj index 82a7fec..545dd9f 100644 --- a/Exceptionhandling/Exceptionhandling.csproj +++ b/Exceptionhandling/Exceptionhandling.csproj @@ -46,6 +46,9 @@ + + + diff --git a/Exceptionhandling/Program.cs b/Exceptionhandling/Program.cs index 3db9f0a..6894f1f 100644 --- a/Exceptionhandling/Program.cs +++ b/Exceptionhandling/Program.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; @@ -12,21 +11,18 @@ namespace Exceptionhandling static void Main(string[] args) { - StreamReader streamreader = null; try { - streamreader = new StreamReader(@"c:\file.zip"); - var content = streamreader.ReadToEnd(); + using(var streamreader = new StreamReader(@"c:\file.zip")) + { + var content = streamreader.ReadToEnd(); + } } catch (Exception ex) { Console.WriteLine("Sorry, an unexpected error occured. :" + ex.Message); } - finally - { - if (streamreader != null) - streamreader.Dispose(); - } } } + } diff --git a/Exceptionhandling/Video.cs b/Exceptionhandling/Video.cs new file mode 100644 index 0000000..0d02b60 --- /dev/null +++ b/Exceptionhandling/Video.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Exceptionhandling +{ + public class Video + { + public string Title { get; set; } + } +} diff --git a/Exceptionhandling/YouTubeApi.cs b/Exceptionhandling/YouTubeApi.cs new file mode 100644 index 0000000..9588170 --- /dev/null +++ b/Exceptionhandling/YouTubeApi.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; + +namespace Exceptionhandling +{ + + public class YouTubeApi + { + public List