共用方式為


Source.GetLineIndexOfPosition Method

Gets the line and column for the specified position.

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

Syntax

'宣告
Public Sub GetLineIndexOfPosition ( _
    position As Integer, _
    <OutAttribute> ByRef line As Integer, _
    <OutAttribute> ByRef col As Integer _
)
public void GetLineIndexOfPosition(
    int position,
    out int line,
    out int col
)

Parameters

  • position
    Type: System.Int32
    The position or character offset into the source file.
  • line
    Type: System.Int32%
    [out] Returns the line number corresponding to the position.
  • col
    Type: System.Int32%
    [out] Returns the column number (offset on the line) corresponding to the position.

Remarks

This method forwards the call to the GetLineIndexOfPosition method on the IVsTextLines object passed to the Source class constructor. An exception is thrown if an error occurs.

.NET Framework Security

See Also

Reference

Source Class

Microsoft.VisualStudio.Package Namespace