Show / Hide Table of Contents

# Class FilePosition

Provides details and operations for a buffer position in a specific file.

##### Inheritance

System.Object
BufferPosition
FilePosition

##### Inherited Members

BufferPosition.None
BufferPosition.Line
BufferPosition.Column
BufferPosition.Equals(Object)
BufferPosition.GetHashCode()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

###### Namespace:Microsoft.SqlTools.ServiceLayer.Workspace.Contracts

###### Assembly:Microsoft.SqlTools.ServiceLayer.dll

##### Syntax

    public class FilePosition : BufferPosition

### Constructors

| Improve this Doc View Source

#### FilePosition(ScriptFile, BufferPosition)

Creates a new FilePosition instance for the specified file by copying the specified BufferPosition

##### Declaration

    public FilePosition(ScriptFile scriptFile, BufferPosition copiedPosition)

##### Parameters

Type | Name | Description
--- | --- | ---
ScriptFile | scriptFile | The ScriptFile in which the position is located.
BufferPosition | copiedPosition | The original BufferPosition from which the line and column will be copied.

| Improve this Doc View Source

#### FilePosition(ScriptFile, Int32, Int32)

Creates a new FilePosition instance for the 1-based line and column numbers in the specified file.

##### Declaration

    public FilePosition(ScriptFile scriptFile, int line, int column)

##### Parameters

Type | Name | Description
--- | --- | ---
ScriptFile | scriptFile | The ScriptFile in which the position is located.
System.Int32 | line | The 1-based line number in the file.
System.Int32 | column | The 1-based column number in the file.

### Methods

| Improve this Doc View Source

#### AddOffset(Int32, Int32)

Gets a FilePosition relative to this position by adding the provided line and column offset relative to the contents of the current file.

##### Declaration

    public FilePosition AddOffset(int lineOffset, int columnOffset)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32 | lineOffset | The line offset to add to this position.
System.Int32 | columnOffset | The column offset to add to this position.

##### Returns

Type | Description
--- | ---
FilePosition | A new FilePosition instance for the calculated position.

| Improve this Doc View Source

#### GetLineEnd()

Gets a FilePosition for the line and column position of the end of the current line.

##### Declaration

    public FilePosition GetLineEnd()

##### Returns

Type | Description
--- | ---
FilePosition | A new FilePosition instance for the calculated position.

| Improve this Doc View Source

#### GetLineStart()

Gets a FilePosition for the line and column position of the beginning of the current line after any initial whitespace for indentation.

##### Declaration

    public FilePosition GetLineStart()

##### Returns

Type | Description
--- | ---
FilePosition | A new FilePosition instance for the calculated position.