Programming/C#
Dictionary 탐색중 삭제하기
SherryBirkin
2017. 8. 17. 12:21
Dictionary<Key, Value> 형태로 쓰게되는데
Key값으로 Loop(반복문)를 돌리고
해당Key만 삭제하면 된다.
foreach(string sKey in Dictionary.Keys.ToList())
{
// Dictionary.Keys[sKey] == value; <- Key로 찾은 Value
Dictionary.Remove(sKey); <- Key를 이용해서 Value 삭제
}