当前位置: 首页>>代码示例>>C#>>正文


C# DomNode.GetAdapter方法代码示例

本文整理汇总了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;
        }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:16,代码来源:DomNodeNamePredicate.cs

示例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));
        }
开发者ID:cococo111111,项目名称:ATF,代码行数:9,代码来源:TestDomNode.cs

示例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);
        }
开发者ID:cococo111111,项目名称:ATF,代码行数:15,代码来源:TestDomNode.cs

示例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);
        }
开发者ID:cococo111111,项目名称:ATF,代码行数:13,代码来源:TestDomNode.cs

示例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);
        }
开发者ID:cococo111111,项目名称:ATF,代码行数:17,代码来源:TestDomNode.cs

示例6: TestGetAdapterAsDomNode

        public void TestGetAdapterAsDomNode()
        {
            DomNodeType type = new DomNodeType("type");
            DomNode node = new DomNode(type);

            Assert.AreSame(node.GetAdapter(typeof(DomNode)), node);
        }
开发者ID:cococo111111,项目名称:ATF,代码行数:7,代码来源:TestDomNode.cs

示例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);
        }
开发者ID:cococo111111,项目名称:ATF,代码行数:9,代码来源:TestDomNode.cs


注:本文中的DomNode.GetAdapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。