比如结果Dictionary<1,你>Add到list里需要先定义你的list
List<Dictionary<int,string>> list=new List<Dictionary<int,string>>();
list.Add();

解决方案 »

  1.   

    先用正则将数据提取出来
    (?<=<)([^>])(?=>)
      

  2.   


      string temp = @"<1>aaa<你>
                                <6>4dfsg<我>
                                <9>sxv zxc zx<他>";
                Regex re = new Regex(@"(?<=<)([^>])(?=>)");
                List<string> list = new List<string>();
                foreach (Match m in re.Matches(temp))
                {
                    if (m.Success)
                    {
                        list.Add(m.Value);
                    }
                }
           //需要的数据已经提取到list里了
      

  3.   


    必须使用Dictionary啊  因为每个字符都有对应的ID 你这样把全部都堆进了List里,我在外面需要用ID来取值^_^
      

  4.   

    Dictionary<string,string> dic=new Dictionary<string,string>();
    Regex reg = new Regex(@"(?<=<)[^>]+(?=>)");
    MatchCollection mc = reg.Matches("");
    foreach (Match m in mc)
    {
      dic.Add(m.Groups[0].Value,m.Groups[1].Value );
    }