Search Results for

    Show / Hide Table of Contents

    Class Location

    A program location in source code.

    Inheritance
    System.Object
    Location
    Inherited Members
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Loretta.CodeAnalysis
    Assembly: Loretta.CodeAnalysis.dll
    Syntax
    public abstract class Location

    Properties

    | Improve this Doc View Source

    IsInSource

    Returns true if the location represents a specific location in a source code file.

    Declaration
    public bool IsInSource { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Kind

    Location kind (None/SourceFile/MetadataFile).

    Declaration
    public abstract LocationKind Kind { get; }
    Property Value
    Type Description
    LocationKind
    | Improve this Doc View Source

    None

    A location of kind LocationKind.None.

    Declaration
    public static Location None { get; }
    Property Value
    Type Description
    Location
    | Improve this Doc View Source

    SourceSpan

    The location within the syntax tree that this location is associated with.

    Declaration
    public virtual TextSpan SourceSpan { get; }
    Property Value
    Type Description
    TextSpan
    Remarks

    If IsInSource returns False this method returns an empty TextSpan which starts at position 0.

    | Improve this Doc View Source

    SourceTree

    The syntax tree this location is located in or null if not in a syntax tree.

    Declaration
    public virtual SyntaxTree SourceTree { get; }
    Property Value
    Type Description
    SyntaxTree

    Methods

    | Improve this Doc View Source

    Create(SyntaxTree, TextSpan)

    Creates an instance of a Location for a span in a SyntaxTree.

    Declaration
    public static Location Create(SyntaxTree syntaxTree, TextSpan textSpan)
    Parameters
    Type Name Description
    SyntaxTree syntaxTree
    TextSpan textSpan
    Returns
    Type Description
    Location
    | Improve this Doc View Source

    Create(String, TextSpan, LinePositionSpan)

    Creates an instance of a Location for a span in a file.

    Declaration
    public static Location Create(string filePath, TextSpan textSpan, LinePositionSpan lineSpan)
    Parameters
    Type Name Description
    System.String filePath
    TextSpan textSpan
    LinePositionSpan lineSpan
    Returns
    Type Description
    Location
    | Improve this Doc View Source

    Equals(Object)

    Declaration
    public abstract override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    System.Object.Equals(System.Object)
    | Improve this Doc View Source

    GetDebuggerDisplay()

    Returns the display string for the debugger.

    Declaration
    protected virtual string GetDebuggerDisplay()
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    GetHashCode()

    Declaration
    public abstract override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    System.Object.GetHashCode()
    | Improve this Doc View Source

    GetLineSpan()

    Gets the location in terms of path, line and column.

    Declaration
    public virtual FileLinePositionSpan GetLineSpan()
    Returns
    Type Description
    FileLinePositionSpan

    FileLinePositionSpan that contains path, line and column information.

    Returns an invalid span (see IsValid) if the information is not available.

    The values are not affected by line mapping directives (#line in C# or #ExternalSource in VB).

    | Improve this Doc View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.Object.ToString()

    Operators

    | Improve this Doc View Source

    Equality(Location, Location)

    Checks whether two locations are equal.

    Declaration
    public static bool operator ==(Location left, Location right)
    Parameters
    Type Name Description
    Location left
    Location right
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Inequality(Location, Location)

    Checks whether two locations are not equal.

    Declaration
    public static bool operator !=(Location left, Location right)
    Parameters
    Type Name Description
    Location left
    Location right
    Returns
    Type Description
    System.Boolean
    • Improve this Doc
    • View Source
    ☀
    ☾
    In This Article
    Back to top

    Copyright (c) LorettaDevs

    Generated by DocFX

    ☀
    ☾