本文整理汇总了C#中System.Collections.Specialized.NameValueCollection.ToQueryString方法的典型用法代码示例。如果您正苦于以下问题:C# NameValueCollection.ToQueryString方法的具体用法?C# NameValueCollection.ToQueryString怎么用?C# NameValueCollection.ToQueryString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Specialized.NameValueCollection
的用法示例。
在下文中一共展示了NameValueCollection.ToQueryString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToQueryString
/// <summary>
/// Returns the query string representation of this processor's values
/// </summary>
/// <returns></returns>
public string ToQueryString()
{
NameValueCollection parameters = new NameValueCollection();
parameters.Add("contrast", ContrastPercentage.ToString());
return parameters.ToQueryString();
}
示例2: Execute
private HttpResponseMessage Execute()
{
var responseMessage = new HttpResponseMessage(HttpStatusCode.Redirect);
var url = _response.RedirectUri.AbsoluteUri;
var query = new NameValueCollection();
if (_response.IdentityToken.IsPresent())
{
query.Add("id_token", _response.IdentityToken);
}
if (_response.AccessToken.IsPresent())
{
query.Add("access_token", _response.AccessToken);
query.Add("token_type", "Bearer");
query.Add("expires_in", _response.AccessTokenLifetime.ToString());
}
if (_response.Scope.IsPresent())
{
query.Add("scope", _response.Scope);
}
if (_response.State.IsPresent())
{
query.Add("state", _response.State);
}
url = string.Format("{0}#{1}", url, query.ToQueryString());
responseMessage.Headers.Location = new Uri(url);
Logger.Info("Redirecting to " + _response.RedirectUri.AbsoluteUri);
return responseMessage;
}
示例3: ToQueryString
/// <summary>
/// Returns the query string representation of this processor's values
/// </summary>
/// <returns></returns>
public string ToQueryString()
{
NameValueCollection parameters = new NameValueCollection();
parameters.Add("alpha", AlphaPercentage.ToString());
return parameters.ToQueryString();
}
示例4: DoRequest
protected ConnectionStatus DoRequest(string method, string path, object data = null, NameValueCollection queryString = null)
{
if (queryString != null)
path += queryString.ToQueryString();
var postData = string.Empty;
var s = data as string;
if (s != null)
postData = s;
else if (data != null)
postData = this.Serialize(data);
switch (method.ToLowerInvariant())
{
case "post": return this.Connection.PostSync(path, postData);
case "put": return this.Connection.PutSync(path, postData);
case "delete":
return string.IsNullOrWhiteSpace(postData)
? this.Connection.DeleteSync(path)
: this.Connection.DeleteSync(path, postData);
case "head": return this.Connection.HeadSync(path);
case "get": return this.Connection.GetSync(path);
}
throw new DslException("Unknown HTTP method " + method);
}
示例5: ToQueryString
public void ToQueryString()
{
var Collection = new NameValueCollection();
Collection.Add("A", "1");
Collection.Add("B", "2");
Assert.Equal("?A=1&B=2", Collection.ToQueryString());
}
示例6: ToQueryString
/// <summary>
/// Returns the query string representation of this processor's values
/// </summary>
/// <returns></returns>
public string ToQueryString()
{
NameValueCollection parameters = new NameValueCollection();
parameters.Add("filter", Filter.ToString().ToLower());
return parameters.ToQueryString();
}
示例7: ToQueryString
/// <summary>
/// Returns the query string representation of this processor's values
/// </summary>
/// <returns></returns>
public string ToQueryString()
{
NameValueCollection parameters = new NameValueCollection();
parameters.Add("saturation", SaturationPercentage.ToString());
return parameters.ToQueryString();
}
示例8: ToQueryString
/// <summary>
/// Returns the query string representation of this processor's values
/// </summary>
/// <returns></returns>
public string ToQueryString()
{
NameValueCollection parameters = new NameValueCollection();
parameters.Add("brightness", BrightnessPercentage.ToString());
return parameters.ToQueryString();
}
示例9: ToQueryString
/// <summary>
/// Returns the query string representation of this processor's values
/// </summary>
/// <returns></returns>
public string ToQueryString()
{
NameValueCollection parameters = new NameValueCollection();
parameters.Add("vignette", true.ToString());
return parameters.ToQueryString();
}
示例10: ToQueryString
/// <summary>
/// Returns the query string representation of this processor's values
/// </summary>
/// <returns></returns>
public string ToQueryString()
{
NameValueCollection parameters = new NameValueCollection();
parameters.Add("quality", Quality.ToString());
return parameters.ToQueryString();
}
示例11: Post
public string Post(string requestUrl, string contentType, NameValueCollection collection)
{
string postData = collection != null ? collection.ToQueryString() : string.Empty;
var result = Post(requestUrl, contentType, postData);
return result;
}
示例12: ToQueryString
/// <summary>
/// Returns the query string representation of this processor's values
/// </summary>
/// <returns></returns>
public string ToQueryString()
{
NameValueCollection parameters = new NameValueCollection();
parameters.Add("preset", Preset);
return parameters.ToQueryString();
}
示例13: ToQueryStringTest
public void ToQueryStringTest()
{
NameValueCollection nvc = new NameValueCollection();
nvc["Title"] = "Mr";
nvc["FirstName"] = "Arthur";
nvc["Surname"] = "Dent";
Assert.AreEqual("?Title=Mr&FirstName=Arthur&Surname=Dent", nvc.ToQueryString());
}
示例14: ToQueryString_NameValueCollection_Question
public void ToQueryString_NameValueCollection_Question()
{
string expectedResult = "?";
NameValueCollection nameValueCollection = new NameValueCollection();
string currentResult = nameValueCollection.ToQueryString();
Assert.AreEqual(expectedResult, currentResult);
}
示例15: HitEndpoint
public XmlNode HitEndpoint(string endPoint, string methodName, NameValueCollection querystring)
{
if(querystring == null)
throw new ArgumentException("querystring parameter cannot be null, please instantiate");
string output = GetEndpointOutput(endPoint, methodName, querystring.ToQueryString() );
XmlNode response = GetResponseNode(output);
AssertError(response);
return response.FirstChild;
}