本文整理汇总了C#中System.Xml.XPath.XPathResult.RemoveChildren方法的典型用法代码示例。如果您正苦于以下问题:C# XPathResult.RemoveChildren方法的具体用法?C# XPathResult.RemoveChildren怎么用?C# XPathResult.RemoveChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XPath.XPathResult
的用法示例。
在下文中一共展示了XPathResult.RemoveChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteComponent
private void WriteComponent(XPathResult result, object value, IDictionaryAdapter dictionaryAdapter)
{
if (result.Property != null)
{
dictionaryAdapter.This.ExtendedProperties.Remove(result.Property.PropertyName);
}
if (value == null)
{
result.Remove();
return;
}
var source = value as IDictionaryAdapter;
if (source != null)
{
var node = result.RemoveChildren();
if (result.Type != source.Meta.Type && result.OmitPolymorphism == false)
{
var xmlType = source.GetXmlMeta().XmlType;
Context.SetXmlType(xmlType.TypeName, xmlType.Namespace, node);
}
var element = (IDictionaryAdapter)ReadComponent(result, false, dictionaryAdapter);
source.CopyTo(element);
}
}
示例2: WriteComponent
private void WriteComponent(XPathResult result, ref object value, IDictionaryAdapter dictionaryAdapter)
{
var source = value as IDictionaryAdapter;
if (source != null)
{
var sourceAdapter = For(source);
if (sourceAdapter != null)
{
var sourceRoot = sourceAdapter.Root;
var resultNode = result.GetNavigator(false);
if (sourceRoot != null && resultNode != null && sourceRoot.IsSamePosition(resultNode))
return;
}
var node = result.RemoveChildren();
if (result.Type != source.Meta.Type && result.OmitPolymorphism == false)
{
var xmlType = source.GetXmlMeta().XmlType;
var context = GetEffectiveContext(dictionaryAdapter);
context.SetXmlType(xmlType.TypeName, xmlType.Namespace, node);
}
var element = (IDictionaryAdapter)ReadComponent(result, false, dictionaryAdapter);
source.CopyTo(element);
value = element;
}
}
示例3: WriteComponent
private void WriteComponent(XPathResult result, ref object value, IDictionaryAdapter dictionaryAdapter)
{
var source = value as IDictionaryAdapter;
if (source != null)
{
var node = result.RemoveChildren();
if (result.Type != source.Meta.Type && result.OmitPolymorphism == false)
{
var xmlType = source.GetXmlMeta().XmlType;
Context.SetXmlType(xmlType.TypeName, xmlType.Namespace, node);
}
var element = (IDictionaryAdapter)ReadComponent(result, false, dictionaryAdapter);
source.CopyTo(element);
value = element;
}
}