Line | |
---|
1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using System.Text; |
---|
5 | using System.Web; |
---|
6 | |
---|
7 | namespace Com.Piwigo.Lib.Proxy.Helper |
---|
8 | { |
---|
9 | public static class PwgProxyReponseHelper<T> |
---|
10 | { |
---|
11 | public static void buildQueryFromArray(List<T> values, String paramName, ref Boolean firstOcc, StringBuilder queryStringBuilder) |
---|
12 | { |
---|
13 | String FormatString = String.Empty; |
---|
14 | if (values != null) |
---|
15 | { |
---|
16 | if (values.Count == 1) |
---|
17 | { |
---|
18 | FormatString = "{0}={1}"; |
---|
19 | } |
---|
20 | else |
---|
21 | { |
---|
22 | FormatString = "{0}[]={1}"; |
---|
23 | } |
---|
24 | if (firstOcc != true) |
---|
25 | { |
---|
26 | FormatString = String.Format("&{0}", FormatString); |
---|
27 | } |
---|
28 | |
---|
29 | foreach (T occurance in values) |
---|
30 | { |
---|
31 | queryStringBuilder.AppendFormat(FormatString, paramName, HttpUtility.UrlEncode(occurance.ToString().ToLower())); |
---|
32 | firstOcc = false; |
---|
33 | } |
---|
34 | |
---|
35 | } |
---|
36 | |
---|
37 | } |
---|
38 | } |
---|
39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.