Dictionary<string, ListView> allListViews;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ClassLibrary1
{
public class Class1
{
private Dictionary<string, ListView> allListViews;
public Class1()
{
allListViews = new Dictionary<string, ListView>();
}
public static void Main()
{
Class1 p = new Class1();
ListView lv1 = new ListView();
lv1.Name = "gan";
p.allListViews["gan"] = lv1;
ListView lv2 = new ListView();
lv2.Name = "quan";
p.allListViews["quan"] = lv2;
foreach (var item in p.allListViews)
{
Console.WriteLine(item.Key + ":" + item.Value);
}
Console.Read();
}
}
}