CodeClass.EndPoint – vlastnost
Získá text bodu, který je umístění konci kódu položky.
Obor názvů: EnvDTE
Sestavení: EnvDTE (v EnvDTE.dll)
Syntaxe
'Deklarace
ReadOnly Property EndPoint As TextPoint
Get
TextPoint EndPoint { get; }
property TextPoint^ EndPoint {
TextPoint^ get ();
}
abstract EndPoint : TextPoint
function get EndPoint () : TextPoint
Hodnota vlastnosti
Typ: EnvDTE.TextPoint
A TextPoint objektu.
Poznámky
Umístění textu bodu je ihned po poslední znak prvek kódu (včetně všech středník, ukončení syntaxe nebo dělicí syntaxe). Načítání vlastnosti implicitně otevře zdrojový soubor, pokud lze otevřít. Některé jazyky však nelze otevřít libovolný soubory na disku a soubory pouze otevřít v aktuálně otevřené řešení.
Poznámka
Deterministický může být po provedení určité typy úprav, což znamená, že jejich hodnoty nelze dovolávat vždy zůstat stejné hodnoty prvků modelu kód jako třídy, struktury, funkce, atributy, delegátů a tak dále. Další informace naleznete v části Změna hodnoty prvku modelu kódu Discovering Code by Using the Code Model (Visual Basic).
Příklady
Sub EndPointExample2(ByVal dte As DTE2)
' Before running this example, open a code document from a project
' and place the insertion point inside a class definition.
Try
' Retrieve the CodeClass at the insertion point.
Dim sel As TextSelection = _
CType(dte.ActiveDocument.Selection, TextSelection)
Dim cls As CodeClass = _
CType(sel.ActivePoint.CodeElement( _
vsCMElement.vsCMElementClass), CodeClass)
Dim start As EditPoint = cls.StartPoint.CreateEditPoint()
Dim def As String = start.GetText(cls.EndPoint)
MsgBox(cls.Name & " has the following definition:" & _
vbCrLf & vbCrLf & def)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
public void EndPointExample2(DTE2 dte)
{
// Before running this example, open a code document from a project
// and place the insertion point inside a class definition.
try
{
// Retrieve the CodeClass at the insertion point.
TextSelection sel =
(TextSelection)dte.ActiveDocument.Selection;
CodeClass cls =
(CodeClass)sel.ActivePoint.get_CodeElement(
vsCMElement.vsCMElementClass);
EditPoint start = cls.StartPoint.CreateEditPoint();
string def = start.GetText(cls.EndPoint);
MessageBox.Show(cls.Name +
" has the following definition:\n\n" + def);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Zabezpečení rozhraní .NET Framework
- Plná důvěra přímému volajícímu. Částečně zabezpečený kód nemůže tento člen použít. Další informace naleznete v tématu Používání knihoven z částečně důvěryhodného kódu.
Viz také
Odkaz
Další zdroje
How to: Compile and Run the Automation Object Model Code Examples