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).

Применяется к