Looping through session variables with LINQ?
linq, session
Solution
The LINQ you have is setting the key to null. I believe this is what you need to actually set the value:
Session.Keys.Cast<string>()
.Where(k => !k.Contains("Selected"))
.ToList()
.ForEach(k => Session[k] = null);
^
Problem
So I'm still rather new to LINQ, so bear with me. I'm trying to check the session variables and if the variable name doesn't contain the key with the name "Selected" then set the value of it to null. This is what I have, though I'm probably not close: ``` Session.Keys.Cast<string>().Where(k => !k.Contains("Selected")).ToList().ForEach(k => k = null); ``` Thanks for the assistance.