GetNameOfLocation Method
Collapse the table of content
Expand the table of content

LanguageService.GetNameOfLocation Method (IVsTextBuffer, Int32, Int32, String, Int32)


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

Namespace:   Microsoft.VisualStudio.Package
Assembly:  Microsoft.VisualStudio.Package.LanguageService.14.0 (in Microsoft.VisualStudio.Package.LanguageService.14.0.dll)

public virtual int GetNameOfLocation(
	IVsTextBuffer buffer,
	int line,
	int col,
	out string name,
	out int lineOffset


Type: Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer

[in] The IVsTextBuffer holding the source file.

Type: System.Int32

[in] The desired line in the buffer.

Type: System.Int32

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

Type: System.String

[out] The name of the enclosing element.

Type: System.Int32

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

Return Value

Type: System.Int32

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

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.

Return to top
© 2015 Microsoft