Partager via


LanguageService.GetNameOfLocation Method

Returns the name of the enclosing element that contains the given position.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)

Syntax

'Declaration
Public Overridable Function GetNameOfLocation ( _
    buffer As IVsTextBuffer, _
    line As Integer, _
    col As Integer, _
    <OutAttribute> ByRef name As String, _
    <OutAttribute> ByRef lineOffset As Integer _
) As Integer
public virtual int GetNameOfLocation(
    IVsTextBuffer buffer,
    int line,
    int col,
    out string name,
    out int lineOffset
)
public:
virtual int GetNameOfLocation(
    IVsTextBuffer^ buffer, 
    int line, 
    int col, 
    [OutAttribute] String^% name, 
    [OutAttribute] int% lineOffset
)
abstract GetNameOfLocation : 
        buffer:IVsTextBuffer * 
        line:int * 
        col:int * 
        name:string byref * 
        lineOffset:int byref -> int  
override GetNameOfLocation : 
        buffer:IVsTextBuffer * 
        line:int * 
        col:int * 
        name:string byref * 
        lineOffset:int byref -> int
public function GetNameOfLocation(
    buffer : IVsTextBuffer, 
    line : int, 
    col : int, 
    name : String, 
    lineOffset : int
) : int

Parameters

  • line
    Type: Int32

    [in] The desired line in the buffer.

  • col
    Type: Int32

    [in] The desired offset on the line in the buffer.

  • name
    Type: String%

    [out] The name of the enclosing element.

  • lineOffset
    Type: Int32%

    [out] The offset from the start of the enclosing element to the given line.

Return Value

Type: Int32
If successful, returns S_OK; otherwise, returns S_FALSE if the location is not within a named entity or returns an error code.

Implements

IVsLanguageDebugInfo.GetNameOfLocation(IVsTextBuffer, Int32, Int32, String%, Int32%)

Remarks

An enclosing element is typically a method, class, or namespace.

The base method returns a null value for the name and 0 for the line offset.

.NET Framework Security

See Also

Reference

LanguageService Class

Microsoft.VisualStudio.Package Namespace