ふらっとC#,C♯,C#(初心者用) Part36
at TECH
182:デフォルトの名無しさん
09/01/24 23:02:46
>>180
こんな感じか? メモ帳で書いただけで検証してないけど。
public static void RemoveAllByValue<TKey, TValue>(
this Dictionary<TKey, TValue> dictionary, Predicate<TValue> match)
{
List<TKey> keys = new List<TKey>();
foreach (TKey key in dictionary.Keys)
{
if (match(dictionary[key]))
{
keys.Add(key);
}
}
foreach (TKey key in dictionary.Keys)
{
dictionary.Remove(key);
}
}
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5000日前に更新/209 KB
担当:undef