C# Dictionary 字典用法 记录

Dictionary 使用

using System.Collections.Generic;

Create Dictionary

Dictionary<decimal, int> dicCIUType = new Dictionary<decimal, int>();

Add to Dictionary

dicCIUType.Add(id, Type);

 

Search in Dictionary

            foreach (KeyValuePair<decimal, int> kvp in dic)

            {

                if (kvp.Key == id)

                {

                    continue;

                }

                if (kvp.Value == Type)

                {

                    return false;

                }

            }

posted @ 2013-01-04 16:53  太古月石  阅读(444)  评论(0编辑  收藏  举报