本文整理汇总了C#中System.Collections.Specialized.NameValueCollection.OfType方法的典型用法代码示例。如果您正苦于以下问题:C# NameValueCollection.OfType方法的具体用法?C# NameValueCollection.OfType怎么用?C# NameValueCollection.OfType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Specialized.NameValueCollection
的用法示例。
在下文中一共展示了NameValueCollection.OfType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteRequest
public XElement ExecuteRequest (NameValueCollection arguments)
{
var doc = new XDocument (
new XElement ("Arguments",
arguments.OfType<string> ().Select (key =>
new XElement ("Argument",
new XElement ("Key", key),
new XElement ("Value", arguments [key])))
.OfType<object> ().ToArray ()));
return doc.Root;
}
示例2: ExecuteRequest
public XElement ExecuteRequest (NameValueCollection arguments)
{
var doc = new XDocument (
new XElement ("Arguments",
arguments.OfType<string> ().Select (key =>
new XElement ("Argument",
new XElement ("Key", key),
new XElement ("Value", arguments [key])))
.OfType<object> ().ToArray ()));
_captureResult (doc.Root);
XNamespace ns = "http://sdb.amazonaws.com/doc/2009-04-15/";
return new XElement(ns + "SelectResponse", new XElement(ns + "SelectResult", new XElement[]
{
new XElement(ns + "Item", new XElement[]{
new XElement(ns + "Name", "ItemName1"),
new XElement(ns + "Attribute", new XElement[] {
new XElement(ns + "Name", "Count"),
new XElement(ns + "Value", 1)
})
})
}));
}
示例3: PostAsForm
public String PostAsForm(String url, NameValueCollection form, Boolean useSignature = false) {
var args = form.OfType<String>().Select(k => new KeyValuePair<String, String>(k, form.Get(k)));
return Post(url, FormSerializer.Serialize(args), FormType, useSignature);
}
示例4: GetBeetleParameters
/// <summary>
/// Gets the beetle parameters.
/// </summary>
/// <param name="parameters">The parameters.</param>
/// <returns></returns>
public static List<KeyValuePair<string, string>> GetBeetleParameters(NameValueCollection parameters) {
if (parameters == null) return null;
return parameters
.OfType<string>()
.Where(k => !string.IsNullOrWhiteSpace(k) && k.StartsWith("!e"))
.Select(k => {
var v = parameters[k];
var i = v.IndexOf(':');
var exp = v.Substring(0, i);
var args = v.Substring(i + 1);
return new KeyValuePair<string, string>(exp, args);
})
.ToList();
}