本文整理汇总了C#中System.Xml.XPath.XPathNodeIterator.Cast方法的典型用法代码示例。如果您正苦于以下问题:C# XPathNodeIterator.Cast方法的具体用法?C# XPathNodeIterator.Cast怎么用?C# XPathNodeIterator.Cast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XPath.XPathNodeIterator
的用法示例。
在下文中一共展示了XPathNodeIterator.Cast方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MonoImpInfo
string MonoImpInfo(string assemblyname, string typename, string membername, XPathNodeIterator itr, bool strlong)
{
if (quiet)
return string.Empty;
var rgs = itr.Cast<XPathNavigator> ().Select (nav => nav.Value).ToList ();
return MonoImpInfo (assemblyname, typename, membername, rgs, strlong);
}
示例2: distinct_values
protected XPathNavigator[] distinct_values(XPathNodeIterator iter)
{
// fn:distinct-values($arg as xs:anyAtomicType*) as xs:anyAtomicType*
XPathNavigator[] nodes = iter.Cast<XPathNavigator>().ToArray();
var distinct = new Dictionary<object, XPathNavigator>();
foreach (object item in nodes.Select(n => n.TypedValue).Distinct()) {
if (!distinct.ContainsKey(item)) {
distinct.Add(item, nodes.First(n => n.TypedValue.Equals(item)));
}
}
return distinct.Values.ToArray();
}
示例3: subsequence
public XPathNavigator[] subsequence(XPathNodeIterator sourceSeq, int startingLoc, int length)
{
// fn:subsequence($sourceSeq as item()*, $startingLoc as xs:double, $length as xs:double) as item()*
return sourceSeq.Cast<XPathNavigator>().Skip(startingLoc).Take(length).ToArray();
}
示例4: tail
public XPathNavigator[] tail(XPathNodeIterator iter)
{
// fn:tail($arg as item()*) as item()*
return iter.Cast<XPathNavigator>().Skip(1).ToArray();
}
示例5: serialize
public string serialize(XPathNodeIterator arg, XPathNodeIterator parameters)
{
// fn:serialize($arg as item()*, $params as element(output:serialization-parameters)?) as xs:string
var itemFactory = new SystemItemFactory();
XPathSerializationOptions options = null;
if (parameters != null
&& parameters.Count == 1) {
options = new XPathSerializationOptions();
((IXmlSerializable)options).ReadXml(parameters.Cast<XPathNavigator>().First().ReadSubtree());
}
using (var writer = new StringWriter()) {
IEnumerable<XPathItem> items = arg.Cast<XPathItem>();
if (options == null) {
itemFactory.Serialize(items, writer);
} else {
itemFactory.Serialize(items, writer, options);
}
return writer.ToString();
}
}