Is there a nice linqy way of splitting a FormCollection
into a Dictionary
that contains only those keys that start wi
If you're looking for a "nice" way of taking an existing dictionary, producing a new dictionary with copies of keys+values, for a subset of the keys, some LINQ code will do this nicely:
var appSettings = formCollection.AllKeys
.Where(k => k.StartsWith("AppSettings."))
.ToDictionary(k => k, k => formCollection[k]);