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;

                }

            }

原文地址:https://www.cnblogs.com/mantian/p/2844489.html