I have declared a dictionary in the following way :
public static Dictionary<string,bool> Features {get;set;}
After this dictionary is populated it has following values :
**[Key],[Value]**
module1.add,true
module1.update,true
module1.delete,true
module1.save,true
module1.clear,true
module2.add,true
module2.update,true
module2.delete,true
module2.save,true
...
module10.add,true
module10.update,true
module10.delete,true
module10.save,true
After it is populated, i need to iterate over dictionary key and update dictionary values.
Ex : wherever i have .add and .delete in key, its value needs to be updated to false.
after update, it must look like this
module1.add,false
module1.update,true
module1.delete,false
module1.save,true
module1.clear,true
module2.add,false
module2.update,true
module2.delete,false
module2.save,true
...
module10.add,false
module10.update,true
module10.delete,false
module10.save,true
Let me know how to iterate through the dictionary and update the value in C#.
Your help is appreciated.
This will get all the keys that end in .add or .delete and update their values to false.
Here it is without linq:
Note that you have to create the separate list of keys to avoid modifying the collection as you enumerate it.