private static void FileBookName(IGradeinterface bookOne) { StreamWriter fout = File.CreateText("fileout.txt"); try { fout.WriteLine(bookOne.getGradeName() + bookOne.GetHashCode().ToString()); } finally { fout.Close(); } }
private static void SetGrade(IGradeinterface bookOne, IGradeinterface bookTwo) { try { bookOne.setGradeName("First grade book"); bookTwo.setGradeName("New grade book"); bookOne.setGradeName("Again First book"); Console.WriteLine(bookOne.getGradeName()); //bookTwo.setGradeName(null); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } finally { Console.WriteLine("After exceptions if any....."); } }