ToString

The ToString() method returns the string representation of a position.

Overloads

ToString()
Returns the string representation of a position.

ToString()

Returns the string representing a Position. It combines the FullName property of the position’s FileInfo, the LineNumber, and the StartColumn.

[ParsedDocument] ToString()

Parameters

None.

Returns

A string including the the FullName property of the position’s FileInfo, its LineNumber, and its StartColumn. The values are separated by colons (:). If the position’s FileInfo property is $null, only the LineNumber and StartColumn values are included.

Exceptions

None.

Examples

The following example demonstrates viewing a position as a string with and without the FileInfo.

[Position]$Position = [Position]@{
    LineNumber  = 5
    StartColumn = 10
}
$Position.ToString()
5:10
[Position]$Position = [Position]@{
    FileInfo    = Get-Item ./README.md
    LineNumber  = 5
    StartColumn = 10
}
$Position.ToString()
C:\code\pwsh\Documentarian\README.md:5:10