public static Container getContainer() { if (container == null) { try { XmlSerializer serializer = new XmlSerializer (typeof(Container)); StreamReader reader = new StreamReader ("Brake.xml"); container = (Container)serializer.Deserialize (reader); reader.Close (); } catch (System.IO.FileNotFoundException) { Console.WriteLine ("=============================="); Console.WriteLine ("Looks like you're new, please fill in the details of your device"); container = new Container (); } } return container; }