Share via


ElementLocation Class

Definition

The ___location of an XML node in a file. Any editing of the project XML through the MSBuild API's will invalidate locations in that XML until the XML is reloaded.

public ref class ElementLocation abstract
public ref class ElementLocation abstract : Microsoft::Build::Shared::IMSBuildElementLocation
[System.Serializable]
public abstract class ElementLocation
[System.Serializable]
public abstract class ElementLocation : Microsoft.Build.Shared.IMSBuildElementLocation
[<System.Serializable>]
type ElementLocation = class
[<System.Serializable>]
type ElementLocation = class
    interface IMSBuildElementLocation
Public MustInherit Class ElementLocation
Public MustInherit Class ElementLocation
Implements IMSBuildElementLocation
Inheritance
ElementLocation
Attributes
Implements

Remarks

This object is IMMUTABLE, so that it can be passed around arbitrarily. DO NOT make these objects any larger. There are huge numbers of them and they are transmitted between nodes.

Constructors

ElementLocation()

Initializes a new instance of the ElementLocation class.

Properties

Column

The column number where this element exists in its file. The first column is numbered 1. Zero indicates "unknown ___location".

EmptyLocation

Gets the empty element ___location. This is not to be used when something is "missing": that should have a null ___location. It is to be used for the project ___location when the project has not been given a name. In that case, it exists, but can't have a specific ___location.

File

The file from which this particular element originated. It may differ from the ProjectFile if, for instance, it was part of an import or originated in a targets file. If not known, returns empty string.

Line

The line number where this element exists in its file. The first line is numbered 1. Zero indicates "unknown ___location".

LocationString

The ___location in a form suitable for replacement into a message. Example: "c:\foo\bar.csproj (12,34)" Calling this creates and formats a new string. PREFER TO PUT THE LOCATION INFORMATION AT THE START OF THE MESSAGE INSTEAD. Only in rare cases should the ___location go within the message itself.

Methods

Create(String, Int32, Int32)

Constructor for the case where we have most or all information. Numerical values must be 1-based, non-negative; 0 indicates unknown File may be null, indicating the file was not loaded from disk.

Equals(Object)

Override Equals so that identical fields imply equal objects.

GetHashCode()

Get reasonable hash code.

ToString()

Location of element.

Applies to