我已经为ListView中的LOADING和SAVING项目和子项构建了这个C#:
private void Form1_Load(object sender, EventArgs e) {
this.Location=Properties.Settings.Default.FormLocation;
if (Properties.Settings.Default.AllePcer == null) {
Properties.Settings.Default.AllePcer = new StringCollection();
}
var items = new ListViewItem[Properties.Settings.Default.AllePcer.Count];
for (int i = 0; i < items.Length; i++) {
items[i] = new ListViewItem(Properties.Settings.Default.AllePcer[i].Split('|'));
}
this.listView1.Items.AddRange(items);
this.Show();
butten_Help.Focus();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
Properties.Settings.Default.FormLocation=this.Location;
Properties.Settings.Default.AllePcer = new StringCollection();
var items = new List<string>();
foreach (ListViewItem item in this.listView1.Items) {
List<string> subitems = new List<string>();
foreach (ListViewItem.ListViewSubItem subitem in item.SubItems) {
subitems.Add(subitem.Text);
}
items.Add(string.Join("|", subitems)); <<<<<<<<<<<<<<<<<<<<
}
Properties.Settings.Default.AllePcer.AddRange(items.ToArray());
Properties.Settings.Default.Save();
}
包含“&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;给我compilingerror:
无法从'System.Collections.Generic.List'转换为 '字符串[]'
我该如何纠正?