Question: Hi i need to pass my Request.Form as a parameter, but first i have to add some key/value pairs to it. I get the exception that the Collection is readonly.

I've tried:

```
System.Collections.Specialized.NameValueCollection myform = Request.Form; 

```

and i get the same error. 

and i've tried:

```
foreach(KeyValuePair<string, string> pair in Request.Form)
{
     Response.Write(Convert.ToString(pair.Key) + " - " + Convert.ToString(pair.Value) + "<br />");
}

```

to test if i can pass it one by one to another dictionary, but i get:

> 
> System.InvalidCastException: Specified
>  cast is not valid.
> 
> 
> 

some help, anyone? Thanx

Answer: 
If your already using MVC then you can do it with 0 lines of code.

```
using System.Web.Mvc;

var dictionary = new Dictionary<string, object>();
Request.Form.CopyTo(dictionary);

```
```
public static IEnumerable<Tuple<string, string>> ToEnumerable(this NameValueCollection collection)
{
    return collection
      //.Keys
        .Cast<string>()
        .Select(key => new Tuple<string, string>(key, collection[key]));
}

```

or

```
public static Dictionary<string, string> ToDictionary(this NameValueCollection collection)
{
    return collection
      //.Keys
        .Cast<string>()
        .ToDictionary(key => key, key => collection[key]));
}

```