CodeClass2.InheritanceKind 属性

定义

获取或设置一个值,该值指示一个类是否可用于创建新类。

public:
 property EnvDTE80::vsCMInheritanceKind InheritanceKind { EnvDTE80::vsCMInheritanceKind get(); void set(EnvDTE80::vsCMInheritanceKind value); };
public:
 property EnvDTE80::vsCMInheritanceKind InheritanceKind { EnvDTE80::vsCMInheritanceKind get(); void set(EnvDTE80::vsCMInheritanceKind value); };
[System.Runtime.InteropServices.DispId(207)]
public EnvDTE80.vsCMInheritanceKind InheritanceKind { [System.Runtime.InteropServices.DispId(207)] get; [System.Runtime.InteropServices.DispId(207)] set; }
[<System.Runtime.InteropServices.DispId(207)>]
[<get: System.Runtime.InteropServices.DispId(207)>]
[<set: System.Runtime.InteropServices.DispId(207)>]
member this.InheritanceKind : EnvDTE80.vsCMInheritanceKind with get, set
Public Property InheritanceKind As vsCMInheritanceKind

属性值

vsCMInheritanceKind

一个 vsCMInheritanceKind 常数。

属性

示例

[C#]

public void CodeClass2InheritanceKindExample(DTE2 dte2)  
{  
    // Before running this example, open a code document from a project  
    // and place the insertion point within a class definition.  
    try  
    {   // Get the CodeClass2 at the insertion point.  
        TextSelection sel =   
        (TextSelection)dte2.ActiveDocument.Selection;  
        CodeClass2 cls = (CodeClass2)sel.ActivePoint.get_CodeElement(  
            vsCMElement.vsCMElementClass);  

        // Show whether class may be inherited.  
        if (cls.InheritanceKind ==   
        vsCMInheritanceKind.vsCMInheritanceKindSealed)  
            MessageBox.Show("This class is sealed");  
        else MessageBox.Show("This class may be used to create a new   
        class");  
    }  
    catch (Exception e)  
    {  
        Console.WriteLine(e.Message);  
    }  
}  

注解

备注

在进行了某些类型的编辑之后,代码模型元素(例如类、结构、函数、特性、委托等)的值可能变为非确定性的,这意味着不能确定它们的值始终保持不变。 有关详细信息,请参阅 "代码模型元素值在 使用代码模型查找代码时 可能发生变化" (Visual Basic) "。

适用于