CodeClass2.EndPoint 屬性

定義

取得位於程式碼類別結尾的編輯點。Gets the edit point that is the location of the end of the code class.

public:
 property EnvDTE::TextPoint ^ EndPoint { EnvDTE::TextPoint ^ get(); };
public:
 property EnvDTE::TextPoint ^ EndPoint { EnvDTE::TextPoint ^ get(); };
[System.Runtime.InteropServices.DispId(11)]
[get: System.Runtime.InteropServices.DispId(11)]
[get: System.Runtime.InteropServices.TypeLibFunc(1024)]
public EnvDTE.TextPoint EndPoint { 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 物件。A TextPoint object.

實作

屬性

範例

[Visual Basic][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#][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);  
    }  
}  

備註

編輯點位置會緊接在程式碼專案的最後一個字元之後 (包括任何分號、終止語法或分隔語法) 。The edit point location is immediately after the last character of the code element (including any semicolon, terminating syntax, or separating syntax). 如果可以開啟原始檔,則提取屬性會以隱含方式開啟它。Fetching the property implicitly opens the source file if it can be opened. 不過,某些語言無法開啟磁片上的任意檔案,而且只能在目前開啟的方案中開啟檔案。Some languages, however, cannot open arbitrary files on the disk and can only open files in a currently open solution.

注意

像是類別、結構、函式、屬性、委派等程式碼模型項目的值,在執行特定類型的編輯後,可能會不具決定性,這表示它們的值不能指望會一律保持相同。The values of code model elements such as classes, structs, functions, attributes, delegates, and so forth can be non-deterministic after making certain kinds of edits, meaning that their values cannot be relied upon to always remain the same. 如需詳細資訊,請參閱程式碼模型專案值在 使用程式碼模型探索程式碼時可能會變更 (Visual Basic) For more information, see the section Code Model Element Values Can Change in Discovering Code by Using the Code Model (Visual Basic).

適用於