if (File.Exists(ModuleListPath)) { File.WriteAllText(ModuleListPath, String.Empty); } foreach (var item in list) { using (StreamWriter stream = new StreamWriter(ModuleListPath,true)) { try { stream.WriteLine(item); } catch { trow; } } }