I'm trying to modify each value in a Dictionary. The answers about how to do that generally look like this (taken from here):
foreach (var key in myDictionary.Keys.ToList())
{
myDictionary[key] = <some kind of new value>
}
Seemingly straightforward, but it doesn't work for me; Visual Studio underlines ToList() and says
'System.Web.UI.WebControls.QueryableDataSourceHelper.ToList(System.Linq.IQueryable, System.Type)' is inaccessible due to its protection level.
Am I doing something wrong? (Obviously yes, but what?)
This is fixed by adding a
using System.Linq;
to the top of the .cs file.
(Jon, since you led me to the right path, if you want to post this as an answer, do so, and I'll erase this answer and give you credit.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With