本文整理汇总了C#中System.Type.IsSubclassOf方法的典型用法代码示例。如果您正苦于以下问题:C# System.Type.IsSubclassOf方法的具体用法?C# System.Type.IsSubclassOf怎么用?C# System.Type.IsSubclassOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Type
的用法示例。
在下文中一共展示了System.Type.IsSubclassOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Type_Index
static public int Type_Index(type T) {
if (T==typeof(invt::Helmet)
|| T.IsSubclassOf(typeof(invt::Helmet)))
return (int) Corpus.Head;
if (T==typeof(invt::Necklace)
|| T.IsSubclassOf(typeof (invt::Necklace)))
return (int) Corpus.Neck;
if (T==typeof(invt::Armor)
|| T.IsSubclassOf(typeof (invt::Armor)))
return (int) Corpus.Chest;
if (T==typeof(invt::Cloak)
|| T.IsSubclassOf(typeof (invt::Cloak)))
return (int) Corpus.Back;
if (T==typeof(invt::Backpack)
|| T.IsSubclassOf(typeof (invt::Backpack)))
return (int) Corpus.Back;
if (T==typeof(invt::Belt)
|| T.IsSubclassOf(typeof (invt::Belt)))
return (int) Corpus.Waist;
if (T==typeof(invt::Clothes)
|| T.IsSubclassOf(typeof (invt::Clothes)))
return (int) Corpus.Frock;
if (T==typeof(invt::Bracers)
|| T.IsSubclassOf(typeof (invt::Bracers)))
return (int) Corpus.Arms;
if (T==typeof(invt::Pants)
|| T.IsSubclassOf(typeof (invt::Pants)))
return (int) Corpus.Legs;
if (T==typeof(invt::Gloves)
|| T.IsSubclassOf(typeof (invt::Gloves)))
return (int) Corpus.Hands;
if (T==typeof(invt::Shoes)
|| T.IsSubclassOf(typeof (invt::Shoes)))
return (int) Corpus.Feet;
if (T==typeof(invt::Flashlight))
return (int) Corpus.Other;
if (T==typeof(invt::Lamp)
|| T.IsSubclassOf(typeof (invt::Lamp)))
return (int) Corpus.HandL;
if (T==typeof(invt::Weapon)
|| T.IsSubclassOf(typeof (invt::Weapon)))
return (int) Corpus.HandR;
return (int) Corpus.All;
}
示例2: Script
/// <summary>
/// Constructor for a Script object.
/// <param name="parent">The parent category of this item.</param>
/// <param name="name">The name of the item.</param>
/// <param name="type">The MonoScript that will be stored in this item.</param>
/// <param name="nodeInfo">Meta information about the node type in the type.</param>
/// </summary>
public Script (Category parent, string name, System.Type type, NodeInfoAttribute nodeInfo) : base (parent, name) {
this.type = type;
this.nodeInfo = nodeInfo;
if (type.IsSubclassOf(typeof(ConditionNode)))
nodeType = NodeType.Condition;
else if (type.IsSubclassOf(typeof(DecoratorNode)))
nodeType = NodeType.Decorator;
else if (type == typeof(MissingNode))
nodeType = NodeType.MissingNode;
else if (type.IsSubclassOf(typeof(CompositeNode)))
nodeType = NodeType.Composite;
else
nodeType = NodeType.Action;
}