private void SaveButton_Click(object sender, EventArgs e) { var section = new Section(); section.title = "文件类型"; foreach (var row in fileTypeslist) { if (row.Name != null && row.Name != "") { section.Contents.Add(row.Name, row.Suffiexs.Replace(",", ",")); } } var sections = IniFileHelper.ReadAllSections(); sections.RemoveAll(s => s.title == "文件类型"); sections.Add(section); IniFileHelper.Save(sections); this.Close(); }