110,556
社区成员
发帖
与我相关
我的任务
分享
public static List<MyLib> lib1;
public static SortedSet<MyLib> Lib2;
public class MyLib
{
public long From;
public long To;
public Area;
}
而不要只会抱着基本的数据。
但愿这对你来说不是对牛弹琴。
Dictionary<int,List<string>> list=new Dictionary<int,List<string>>();
list.Add(1,new List<string>(){ "2323","23432","344334","435445" });
list.Add(2,new List<string>(){ "1111","2222","3333" });
List<string> list = new List<string>() { "218.173.0.0:218.213.255.255" };
Dictionary<string, List<string>> ipSet = new Dictionary<string, List<string>>();
List<string> temp = new List<string>();
foreach (string ipArea in list)
{
temp.Clear();
string[] ips = ipArea.Split(':')[0].Split('.');
string[] ipe = ipArea.Split(':')[1].Split('.');
for (int m = int.Parse(ips[0]); m <= int.Parse(ipe[0]); m++)
{
for (int n = int.Parse(ips[1]); n <= int.Parse(ipe[1]); n++)
{
for (int i = int.Parse(ips[2]); i <= int.Parse(ipe[2]); i++)
{
for (int j = int.Parse(ips[3]); j <= int.Parse(ipe[3]); j++)
{
temp.Add(string.Format("{0}:{1}:{2}:{3}", m, n, i, j));
}
}
}
}
ipSet.Add(ipArea, temp);
}