/// <summary>
/// 移除为空的Key
/// </summary>
/// <param name="dic"></param>
/// <returns></returns>
private static Dictionary<string, string> RemoveNullKey(Dictionary<string, string> dic)
{
string keyNames = "";
foreach (string key in dic.Keys)
{
if(string.IsNullOrEmpty(dic[key]))
{
keyNames += key + ",";
}
}
string[] str_keyNames = keyNames.Split(new char[] { ‘,‘ }, StringSplitOptions.RemoveEmptyEntries);
foreach (string key in str_keyNames)
{
dic.Remove(key);
}
return dic;
}
原文地址:https://www.cnblogs.com/jhj-jerry/p/10950565.html
时间: 2024-10-19 02:49:23