本文整理汇总了C#中DomNode.GetAdapter方法的典型用法代码示例。如果您正苦于以下问题:C# DomNode.GetAdapter方法的具体用法?C# DomNode.GetAdapter怎么用?C# DomNode.GetAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DomNode
的用法示例。
在下文中一共展示了DomNode.GetAdapter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDomNodeProperties
/// <summary>
/// Gets an enumeration of properties for a specific DomNode</summary>
/// <param name="node">DomNode on which to obtain properties</param>
/// <returns>Enumeration of properties</returns>
static internal PropertyDescriptorCollection GetDomNodeProperties(DomNode node)
{
if (node == null)
return null;
ICustomTypeDescriptor iCustomTypeDescriptor = node.GetAdapter(typeof(CustomTypeDescriptorNodeAdapter)) as ICustomTypeDescriptor;
if (iCustomTypeDescriptor == null)
return null;
PropertyDescriptorCollection properties = iCustomTypeDescriptor.GetProperties();
return properties;
}
示例2: TestEqualityNonDomNodeAdapter
public void TestEqualityNonDomNodeAdapter()
{
DomNodeType type = new DomNodeType("type");
type.Define(new ExtensionInfo<NonDomNodeAdapter>());
DomNode node = new DomNode(type);
NonDomNodeAdapter test = node.GetAdapter(typeof(NonDomNodeAdapter)) as NonDomNodeAdapter;
Assert.True(node.Equals(test));
}
示例3: TestGetDecoratorsInherited
public void TestGetDecoratorsInherited()
{
DomNodeType baseType = new DomNodeType("baseType");
baseType.Define(new ExtensionInfo<DerivedAdapter>()); // derived adapter on base type!
DomNodeType derivedType = new DomNodeType("derivedType");
derivedType.BaseType = baseType;
derivedType.Define(new ExtensionInfo<SimpleAdapter>());
DomNode node = new DomNode(derivedType);
object simple = node.GetAdapter(typeof(SimpleAdapter));
object derived = node.GetAdapter(typeof(DerivedAdapter));
// test that they're returned in order of inheritance
Utilities.TestSequenceEqual(node.GetDecorators(typeof(SimpleAdapter)), simple, derived);
}
示例4: TestGetDecorators
public void TestGetDecorators()
{
DomNodeType type = new DomNodeType("type");
type.Define(new ExtensionInfo<SimpleAdapter>());
type.Define(new ExtensionInfo<DerivedAdapter>());
DomNode node = new DomNode(type);
object simple = node.GetAdapter(typeof(SimpleAdapter));
object derived = node.GetAdapter(typeof(DerivedAdapter));
// test that they're returned in order of definition on node
Utilities.TestSequenceEqual(node.GetDecorators(typeof(SimpleAdapter)), simple, derived);
}
示例5: TestGetAdapterInherited
public void TestGetAdapterInherited()
{
DomNodeType baseType = new DomNodeType("baseType");
baseType.Define(new ExtensionInfo<DerivedAdapter>()); // derived adapter on base type!
DomNodeType derivedType = new DomNodeType("derivedType");
derivedType.BaseType = baseType;
derivedType.Define(new ExtensionInfo<SimpleAdapter>());
DomNode node = new DomNode(derivedType);
object adapter = node.GetAdapter(typeof(SimpleAdapter));
Assert.True(
(adapter is SimpleAdapter) &&
!(adapter is DerivedAdapter));
adapter = node.GetAdapter(typeof(DerivedAdapter));
Assert.True(adapter is DerivedAdapter);
}
示例6: TestGetAdapterAsDomNode
public void TestGetAdapterAsDomNode()
{
DomNodeType type = new DomNodeType("type");
DomNode node = new DomNode(type);
Assert.AreSame(node.GetAdapter(typeof(DomNode)), node);
}
示例7: TestGetNonDomNodeAdapter
public void TestGetNonDomNodeAdapter()
{
DomNodeType type = new DomNodeType("type");
type.Define(new ExtensionInfo<NonDomNodeAdapter>());
DomNode node = new DomNode(type);
NonDomNodeAdapter test = node.GetAdapter(typeof(NonDomNodeAdapter)) as NonDomNodeAdapter;
Assert.NotNull(test);
}