-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathQueryStringParameter.cs
28 lines (25 loc) · 1009 Bytes
/
QueryStringParameter.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System.Collections.Generic;
using System.Collections.Specialized;
namespace SparkyTestHelpers.AspNetMvc
{
/// <summary>
/// <see cref="QueryStringParameter" /> extension methods.
/// </summary>
public static class QueryStringParameterExensionMethods
{
/// <summary>
/// Creates <see cref="NameValueCollection" /> from <see cref="QueryStringParameter"/>s.
/// </summary>
/// <param name="queryStringParameters"><see cref="QueryStringParameter"/>s.</param>
/// <returns><see cref="NameValueCollection"/>.</returns>
public static NameValueCollection ToNameValueCollection(this IEnumerable<QueryStringParameter> queryStringParameters)
{
var nameValueCollection = new NameValueCollection();
foreach (QueryStringParameter item in queryStringParameters)
{
nameValueCollection.Add(item.Name, item.Value);
}
return nameValueCollection;
}
}
}