public static readonly Dictionary<int, string> DictTask = new Dictionary<int, string>(6)
        {
            { 10, "代表业务" },
                { 1001, "代送文件" },
                { 1002, "文件急送" },
                { 1003, "盖章证明" },
            { 11, "品牌设计" },
                { 1101, "标志设计" },
                { 1102, "VI设计" },
            { 12, "应用设计" }
        }; 
    
如何获取字典中中10开始不包含10的数据 就是1001,,1002,1003

解决方案 »

  1.   

    public static readonly Dictionary<int, string> DictTask = new Dictionary<int, string>(6)跟你想要的效果匹配么?
      

  2.   


    那你Key还是用string的好。。用str.StartsWith...看Key是不是以XX开头的。。
      

  3.   

                Regex reg = new Regex(@"^10\d+$");
                List<int> keyList = new List<int>();            
                foreach (KeyValuePair<int, string> dic in DictTask)
                {
                    if(reg.IsMatch(dic.Key.ToString()))
                    {
                        keyList.Add(dic.Key);
                    }               
                }            //keyList中就是你想要的
      

  4.   

    http://blog.csdn.net/xss2xss/archive/2009/02/03/3860002.aspx