public void getServersList(Form_main formMain) { formMain.serverList.Clear(); if (File.Exists(settingsHelper.userPath + settingsHelper.settingsFilename)) { XDocument xSettings = XDocument.Load(settingsHelper.userPath + settingsHelper.settingsFilename); var queryAll = from q in xSettings.Descendants("Database") select q; foreach (var item in queryAll) { formMain.serverList.Add( new ServerInfo { address = item.Element("Server").Value, dbName = item.Element("DbName").Value, userName = item.Element("User").Value, isDefault = item.Element("Default").Value, }); } } }