How do I access a NameValueCollection (like Request.Form or ConfigurationManager.AppSettings) as a dynamic object?
问题 Is there a way to access a NameValueCollection (like Request.Form or ConfigurationManager.AppSettings) as a dynamic object? I'd like to be able to do something like this: var settings = ConfigurationManager.AppSettings.AsDynamic(); var name = settings.Name; // ConfigurationManger.AppSettings["Name"] // but also settings.Name = "Jones"; // modify the original collection // and var form = Request.Form.AsDynamic(); var email = form.Email; // Request.Form["Email"] (this question is based on