Właściwość CodeClass2.InheritanceKind —
Pobiera lub ustawia wartość wskazującą, czy klasy mogą być używane do tworzenia nowych klas.
Przestrzeń nazw: EnvDTE80
Zestaw: EnvDTE80 (w EnvDTE80.dll)
Składnia
'Deklaracja
Property InheritanceKind As vsCMInheritanceKind
vsCMInheritanceKind InheritanceKind { get; set; }
property vsCMInheritanceKind InheritanceKind {
vsCMInheritanceKind get ();
void set (vsCMInheritanceKind value);
}
abstract InheritanceKind : vsCMInheritanceKind with get, set
function get InheritanceKind () : vsCMInheritanceKind
function set InheritanceKind (value : vsCMInheritanceKind)
Wartość właściwości
Typ: EnvDTE80.vsCMInheritanceKind
A vsCMInheritanceKind stałych.
Uwagi
[!UWAGA]
Wartości elementów modelu kodu, takich jak klasy, strukturach, funkcje, atrybuty, delegatów i tak dalej mogą być deterministyczny po dokonaniu niektórych rodzajów modyfikacji, co oznacza, że ich wartości nie mogą być powoływane do zawsze pozostają takie same.Aby uzyskać więcej informacji, zobacz sekcję wartości elementu modelu kod można zmienić w Odnajdowanie kodu za pomocą modelu kodu (Visual Basic).
Przykłady
[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);
}
}
Zabezpieczenia programu .NET Framework
- Pełne zaufanie do bezpośredniego wywołującego. Tego elementu członkowskiego nie można używać w kodzie częściowo zaufanym. Aby uzyskać więcej informacji, zobacz Używanie bibliotek pochodzących z częściowo zaufanego kodu.
Zobacz też
Informacje
Inne zasoby
Porady: kompilowanie i uruchamianie kodu modelu obiektów automatyzacji — przykłady