本文整理汇总了C#中IDictionaryAdapter.CreateChildAdapter方法的典型用法代码示例。如果您正苦于以下问题:C# IDictionaryAdapter.CreateChildAdapter方法的具体用法?C# IDictionaryAdapter.CreateChildAdapter怎么用?C# IDictionaryAdapter.CreateChildAdapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDictionaryAdapter
的用法示例。
在下文中一共展示了IDictionaryAdapter.CreateChildAdapter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetValue
public override void SetValue(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor, ref object value)
{
// Require a dictionary adapter
var source = value as IDictionaryAdapter;
if (source == null)
throw Error.NotDictionaryAdapter("value");
// Detect assignment of own value
var sourceAdapter = XmlAdapter.For(source, false);
if (sourceAdapter != null && node.PositionEquals(sourceAdapter.Node))
return;
// Create a fresh component
var targetAdapter = new XmlAdapter(node.Save(), XmlAdapter.For(parent).References);
if (sourceAdapter != null)
targetAdapter.References.UnionWith(sourceAdapter.References);
var component = (IDictionaryAdapter) parent.CreateChildAdapter(node.ClrType, targetAdapter);
// Copy value onto fresh component
source.CopyTo(component);
value = component;
}
示例2: GetValue
public override object GetValue(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor)
{
var adapter = new XmlAdapter(node.Save(), XmlAdapter.For(parent).References);
return parent.CreateChildAdapter(node.ClrType, adapter);
}
示例3: GetStub
public override object GetStub(IXmlNode node, IDictionaryAdapter parent, IXmlAccessor accessor)
{
// TODO: Refactor
var adapter = new XmlAdapter(node, XmlAdapter.For(parent).References);
return parent.CreateChildAdapter(accessor.ClrType, adapter);
}