Udostępnij za pośrednictwem


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
[System.Serializable]
public abstract class ElementLocation
[<System.Serializable>]
type ElementLocation = class
Public MustInherit Class ElementLocation
Inheritance
ElementLocation
Attributes

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

Equals(Object)

Override Equals so that identical fields imply equal objects.

GetHashCode()

Get reasonable hash code.

ToString()

Location of element.

Applies to