我有一个本质上是名称值对的锯齿状数组 - 我需要从中生成一组唯一的名称值。锯齿状数组大约有 86,000 x 11 个值。我必须以何种方式存储名称值对(单个字符串“name=value”或专用类,例如 KeyValuePair)对我来说并不重要。
附加信息:有 40 个不同的名称和更多的不同值 - 可能在区域 10,000 个值中。
我正在使用 C# 和 .NET 2.0(性能太差了,我认为将整个锯齿状数组推入 sql 数据库并从那里进行选择可能会更好)。
以下是我正在使用的当前代码:
List<List<KeyValuePair<string,string>>> vehicleList = retriever.GetVehicles();
this.statsLabel.Text = "Unique Vehicles: " + vehicleList.Count;
Dictionary<KeyValuePair<string, string>, int> uniqueProperties = new Dictionary<KeyValuePair<string, string>, int>();
foreach (List<KeyValuePair<string, string>> vehicle in vehicleList)
{
foreach (KeyValuePair<string, string> property in vehicle)
{
if (!uniqueProperties.ContainsKey(property))
{
uniqueProperties.Add(property, 0);
}
}
}
this.statsLabel.Text += "\rUnique Properties: " + uniqueProperties.Count;