Struct FileLinePositionSpan
Represents a span of text in a source code file in terms of file name, line number, and offset within line. However, the file is actually whatever was passed in when asked to parse; there may not really be a file.
Implements
Inherited Members
Namespace: Loretta.CodeAnalysis
Assembly: Loretta.CodeAnalysis.dll
Syntax
public readonly struct FileLinePositionSpan
Constructors
| Improve this Doc View SourceFileLinePositionSpan(String, LinePosition, LinePosition)
Initializes the FileLinePositionSpan instance.
Declaration
public FileLinePositionSpan(string path, LinePosition start, LinePosition end)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The file identifier - typically a relative or absolute path. |
LinePosition | start | The start line position. |
LinePosition | end | The end line position. |
FileLinePositionSpan(String, LinePositionSpan)
Initializes the FileLinePositionSpan instance.
Declaration
public FileLinePositionSpan(string path, LinePositionSpan span)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The file identifier - typically a relative or absolute path. |
LinePositionSpan | span | The span. |
Properties
| Improve this Doc View SourceEndLinePosition
Gets the LinePosition of the end of the span.
Declaration
public readonly LinePosition EndLinePosition { get; }
Property Value
Type | Description |
---|---|
LinePosition |
HasMappedPath
True if the Path is a mapped path.
Declaration
public readonly bool HasMappedPath { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
A mapped path is a path specified in source via #line
(C#) or #ExternalSource
(VB) directives.
IsValid
Returns true if the span represents a valid location.
Declaration
public readonly bool IsValid { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Path
Path, or null if the span represents an invalid value.
Declaration
public readonly string Path { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Path may be System.String.Empty if not available.
Span
Gets the span.
Declaration
public readonly LinePositionSpan Span { get; }
Property Value
Type | Description |
---|---|
LinePositionSpan |
StartLinePosition
Gets the LinePosition of the start of the span.
Declaration
public readonly LinePosition StartLinePosition { get; }
Property Value
Type | Description |
---|---|
LinePosition |
Methods
| Improve this Doc View SourceEquals(FileLinePositionSpan)
Determines if two FileLinePositionSpan objects are equal.
Declaration
public readonly bool Equals(FileLinePositionSpan other)
Parameters
Type | Name | Description |
---|---|---|
FileLinePositionSpan | other |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
The path is treated as an opaque string, i.e. a case-sensitive comparison is used.
Equals(Object)
Determines if two FileLinePositionSpan objects are equal.
Declaration
public override readonly bool Equals(object other)
Parameters
Type | Name | Description |
---|---|---|
System.Object | other |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
GetHashCode()
Serves as a hash function for FileLinePositionSpan.
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | The hash code. |
Overrides
Remarks
The path is treated as an opaque string, i.e. a case-sensitive hash is calculated.
ToString()
Returns a System.String that represents FileLinePositionSpan.
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
System.String | The string representation of FileLinePositionSpan. |
Overrides
Examples
Path: (0,0)-(5,6)
Operators
| Improve this Doc View SourceEquality(FileLinePositionSpan, FileLinePositionSpan)
Checks whether two spans are equal.
Declaration
public static bool operator ==(FileLinePositionSpan left, FileLinePositionSpan right)
Parameters
Type | Name | Description |
---|---|---|
FileLinePositionSpan | left | |
FileLinePositionSpan | right |
Returns
Type | Description |
---|---|
System.Boolean |
Inequality(FileLinePositionSpan, FileLinePositionSpan)
Checks whether two spans are not equal.
Declaration
public static bool operator !=(FileLinePositionSpan left, FileLinePositionSpan right)
Parameters
Type | Name | Description |
---|---|---|
FileLinePositionSpan | left | |
FileLinePositionSpan | right |
Returns
Type | Description |
---|---|
System.Boolean |