1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace MySystem
- {
- public sealed class DictionaryClass
- {
- #region 根据字典key获取字典值
- public string getDictionaryNameByKey(Dictionary<string, string> data, string key)
- {
- if (data.ContainsKey(key))
- {
- return data[key];
- }
- return "";
- }
- public string getDictionaryNameById(Dictionary<int, string> data, int key)
- {
- if (data.ContainsKey(key))
- {
- return data[key];
- }
- return "";
- }
- public string getDictionaryNamesByKeys(Dictionary<string, string> data, string keys)
- {
- string result = "";
- string[] keylist = keys.Split(',');
- foreach (string subkey in keylist)
- {
- if (data.ContainsKey(subkey))
- {
- result += data[subkey] + ",";
- }
- }
- return result.TrimEnd(',');
- }
- #endregion
- }
- }
|