本文整理汇总了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));
}
示例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;
}
示例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;
}
}
}
}
}
示例4: GetNodesOfType
private IEnumerable<DomNode> GetNodesOfType(DomNode rootNode, DomNodeType domNodeType)
{
foreach (DomNode domNode in rootNode.Subtree)
if (domNodeType.IsAssignableFrom(domNode.Type))
yield return domNode;
}