CodeClass2.EndPoint Propriedade
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Obtém o ponto de edição que é o local do final da classe de código.
public:
property EnvDTE::TextPoint ^ EndPoint { EnvDTE::TextPoint ^ get(); };
public:
property EnvDTE::TextPoint ^ EndPoint { EnvDTE::TextPoint ^ get(); };
[System.Runtime.InteropServices.DispId(11)]
public EnvDTE.TextPoint EndPoint { [System.Runtime.InteropServices.DispId(11)] [System.Runtime.InteropServices.TypeLibFunc(1024)] get; }
[<System.Runtime.InteropServices.DispId(11)>]
[<get: System.Runtime.InteropServices.DispId(11)>]
[<get: System.Runtime.InteropServices.TypeLibFunc(1024)>]
member this.EndPoint : EnvDTE.TextPoint
Public ReadOnly Property EndPoint As TextPoint
Valor da propriedade
Um objeto TextPoint.
Implementações
- Atributos
Exemplos
[Visual Basic]
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
[C#]
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);
}
}
Comentários
O local do ponto de edição é imediatamente após o último caractere do elemento de código (incluindo qualquer ponto e vírgula, a sintaxe de terminação ou a sintaxe de separação). A busca da propriedade abrirá implicitamente o arquivo de origem se ele puder ser aberto. No entanto, alguns idiomas não podem abrir arquivos arbitrários no disco e só podem abrir arquivos em uma solução aberta no momento.
Observação
Os valores dos elementos de modelo de código, como classes, structs, funções, atributos, delegados e assim por diante, podem ser não determinísticos depois de fazer determinados tipos de edições, o que significa que seus valores não podem ser dependentes para sempre permanecerem os mesmos. Para obter mais informações, consulte os valores de elemento de modelo de código de seção podem ser alterados na descoberta de código usando o modelo de código (Visual Basic).