CodeClass2.EndPoint Свойство

Определение

Получает точку редактирования, соответствующую концу класса кода.

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

Значение свойства

TextPoint

Объект TextPoint.

Реализации

Атрибуты

Примеры

[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);  
    }  
}  

Комментарии

Место расположения точки редактирования находится сразу после последнего символа элемента кода (включая точку с запятой, завершающий синтаксис или разделитель синтаксиса). Выборка свойства неявно открывает исходный файл, если его можно открыть. Однако некоторые языки не позволяют открывать произвольные файлы на диске и открывать файлы только в открытом в настоящее время решении.

Примечание

Значения элементов модели кода, таких как классы, структуры, функции, атрибуты, делегаты и другие, после внесения некоторых изменений могут оказаться недетерминированными, другими словами, нельзя рассчитывать, что их значения будут всегда оставаться одинаковыми. Дополнительные сведения см. в разделе значения элементов модели кода могут изменяться при обнаружении кода с помощью модели кода (Visual Basic).

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