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


C# DomNodeType.IsAssignableFrom方法代码示例

本文整理汇总了C#中DomNodeType.IsAssignableFrom方法的典型用法代码示例。如果您正苦于以下问题:C# DomNodeType.IsAssignableFrom方法的具体用法?C# DomNodeType.IsAssignableFrom怎么用?C# DomNodeType.IsAssignableFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DomNodeType的用法示例。


在下文中一共展示了DomNodeType.IsAssignableFrom方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestIsAssignableFrom

        public void TestIsAssignableFrom()
        {
            DomNodeType parent = new DomNodeType("parent");
            Assert.True(parent.IsAssignableFrom(parent));

            DomNodeType child = new DomNodeType("child");
            child.BaseType = parent;

            Assert.True(parent.IsAssignableFrom(child));
            Assert.False(child.IsAssignableFrom(parent));
        }
开发者ID:sbambach,项目名称:ATF,代码行数:11,代码来源:TestDomNodeType.cs

示例2: GetNodeTypes

        /// <summary>
        /// Gets all node types derived from base type</summary>
        /// <param name="baseType">Base type</param>
        /// <remarks>Base type is not returned in the array.</remarks>
        /// <returns>Enumeration of all node types derived from baseType</returns>
        public IEnumerable<DomNodeType> GetNodeTypes(DomNodeType baseType)
        {
            if (baseType == null)
                throw new ArgumentNullException("baseType");

            foreach (DomNodeType type in m_nodeTypes.Values)
                if (type != baseType && baseType.IsAssignableFrom(type))
                    yield return type;
        }
开发者ID:Jheengut,项目名称:LevelEditor,代码行数:14,代码来源:XmlSchemaTypeLoader.cs

示例3: FindAll

 /// <summary>
 /// Find all the DomNodes of the type that is equal or derived 
 /// from the given type.
 /// if exact is true then only find DomNode that have exact type.        
 /// </summary>
 /// <param name="type">DomNodeType</param>
 /// <param name="exact">if true then only consider exact match,
 /// otherwise match any type that is equal or derived from the given type</param>
 /// <returns></returns>
 public static IEnumerable<DomNode> FindAll(DomNodeType type, bool exact = false)
 {
     if (type != null)
     {
         IGameDocumentRegistry gameDocumentRegistry = Globals.MEFContainer.GetExportedValue<IGameDocumentRegistry>();
         if (gameDocumentRegistry != null)
         {
             foreach (IGameDocument doc in gameDocumentRegistry.Documents)
             {
                 DomNode folderNode = doc.RootGameObjectFolder.Cast<DomNode>();
                 foreach (DomNode childNode in folderNode.Subtree)
                 {
                     if ((exact && childNode.Type == type)
                         || (!exact && type.IsAssignableFrom(childNode.Type)))
                         yield return childNode;
                 }
             }
         }
     }
 }
开发者ID:ldh9451,项目名称:XLE,代码行数:29,代码来源:Util.cs

示例4: GetNodesOfType

 private IEnumerable<DomNode> GetNodesOfType(DomNode rootNode, DomNodeType domNodeType)
 {
     foreach (DomNode domNode in rootNode.Subtree)
         if (domNodeType.IsAssignableFrom(domNode.Type))
             yield return domNode;
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:6,代码来源:PaletteCommands.cs


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