在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
using System; using System.Windows.Forms; using ClassLibrary2; using System.Collections.Generic; namespace messageshow { public partial class Form1 : Form { public Form1() { InitializeComponent(); Adda(); } private void listView1_SelectedIndexChanged(object sender, EventArgs e) { } public void Adda() { Class1 class1 = new Class1 { Text = "a", Project = "b", Object = "c", Location = "d", wRONGTYPE = Value.WRONGTYPE.WARNING }; Class1 class2 = new Class1 { Text = "文本", Project = "项目", Object = "对象", Location = "位置", wRONGTYPE = Value.WRONGTYPE.WARNING }; List<Class1> class1s = new List<Class1> { class1, class2 }; Value.Collection.Add(Value.WRONGTYPE.WARNING, class1s); // li.Text = "1"; foreach (Class1 u in Value.Collection[Value.WRONGTYPE.WARNING]) { string[] sub = new string[] { "", u.Text, u.Project, u.Object, u.Location }; ListViewItem li; li = new ListViewItem(sub); // this.listView3.Items.Add(li); } } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ClassLibrary2 { public static class Value { public enum WRONGTYPE { WRONG, WARNING } public static Dictionary<WRONGTYPE, List<Class1>> Collection = new Dictionary<WRONGTYPE, List<Class1>>(); } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ClassLibrary2 { public class Class1 { public string Text; public string Project; public string Object; public string Location; public Value.WRONGTYPE wRONGTYPE; } }
|
请发表评论