CodeDelegate2.GetEndPoint(vsCMPart) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回一个 TextPoint 对象,该对象标记委托定义的末尾。
EnvDTE::TextPoint GetEndPoint(EnvDTE::vsCMPart Part = EnvDTE.vsCMPart.vsCMPartWholeWithAttributes);
[System.Runtime.InteropServices.DispId(16)]
[System.Runtime.InteropServices.TypeLibFunc(1024)]
public EnvDTE.TextPoint GetEndPoint (EnvDTE.vsCMPart Part = EnvDTE.vsCMPart.vsCMPartWholeWithAttributes);
[<System.Runtime.InteropServices.DispId(16)>]
[<System.Runtime.InteropServices.TypeLibFunc(1024)>]
abstract member GetEndPoint : EnvDTE.vsCMPart -> EnvDTE.TextPoint
Public Function GetEndPoint (Optional Part As vsCMPart = EnvDTE.vsCMPart.vsCMPartWholeWithAttributes) As TextPoint
参数
返回
TextPoint 对象。
实现
- 属性
示例
在运行此示例之前,请加载一个具有类的项目,并插入以下代码行以及示例代码。 在添加行和示例代码后,单击 Delegate 该行以将插入点放置在该处,然后运行该示例。
Microsoft.visualbasic.dll
Delegate Sub MySubDelegate(ByVal x As Integer)
[C#]
public delegate void MySubDelegate(int x);
Microsoft.visualbasic.dll
Public Sub getStartEndPointExample(ByVal dte As DTE2)
Try
' Retrieve the CodeClass at the insertion point.
Dim sel As TextSelection = _
CType(dte.ActiveDocument.Selection, TextSelection)
Dim del As CodeDelegate2 = _
CType(sel.ActivePoint.CodeElement( _
vsCMElement.vsCMElementDelegate), CodeDelegate2)
Dim sb As New System.Text.StringBuilder
' Get the start and endpoint offsest for the delegate.
sb.AppendLine("Startpoint: " & _
del.GetStartPoint(vsCMPart.vsCMPartBody) _
.LineCharOffset.ToString)
sb.AppendLine("Endpoint: " & _
del.GetEndPoint(vsCMPart.vsCMPartBody) _
.LineCharOffset.ToString)
MessageBox.Show(sb.ToString)
Catch ex As System.Exception
MsgBox(ex.ToString)
End Try
End Sub
注解
TextPoint对象表示委托定义的结尾。 Part参数定义要返回的委托部分。
备注
在进行了某些类型的编辑之后,代码模型元素(例如类、结构、函数、特性、委托等)的值可能变为非确定性的,这意味着不能确定它们的值始终保持不变。 有关详细信息,请参阅 "代码模型元素值在 使用代码模型查找代码时 可能发生变化" (Visual Basic) "。