共用方式為


IProjectionSnapshot.MapToSourceSnapshot Method

Definition

Overloads

MapToSourceSnapshot(Int32)

Maps a position in the projection snapshot to the corresponding position in a source snapshot. If the mapping is ambiguous (occurs on a source span seam), see GetTypicalInsertionPosition(SnapshotPoint, ReadOnlyCollection<SnapshotPoint>) to choose a source buffer.

MapToSourceSnapshot(Int32, PositionAffinity)

Maps a position in the projection snapshot to the corresponding position in a source snapshot.

MapToSourceSnapshot(Int32)

Maps a position in the projection snapshot to the corresponding position in a source snapshot. If the mapping is ambiguous (occurs on a source span seam), see GetTypicalInsertionPosition(SnapshotPoint, ReadOnlyCollection<SnapshotPoint>) to choose a source buffer.

public:
 Microsoft::VisualStudio::Text::SnapshotPoint MapToSourceSnapshot(int position);
public Microsoft.VisualStudio.Text.SnapshotPoint MapToSourceSnapshot (int position);
abstract member MapToSourceSnapshot : int -> Microsoft.VisualStudio.Text.SnapshotPoint
Public Function MapToSourceSnapshot (position As Integer) As SnapshotPoint

Parameters

position
Int32

The position in the projection snapshot.

Returns

An SnapshotPoint.

Exceptions

position is less than zero or greater than or equal to the length of the snapshot.

Remarks

If the mapping is ambiguous (occurs on a source span seam), see GetTypicalInsertionPosition to choose a source buffer.

Applies to

MapToSourceSnapshot(Int32, PositionAffinity)

Maps a position in the projection snapshot to the corresponding position in a source snapshot.

public:
 Microsoft::VisualStudio::Text::SnapshotPoint MapToSourceSnapshot(int position, Microsoft::VisualStudio::Text::PositionAffinity affinity);
public Microsoft.VisualStudio.Text.SnapshotPoint MapToSourceSnapshot (int position, Microsoft.VisualStudio.Text.PositionAffinity affinity);
abstract member MapToSourceSnapshot : int * Microsoft.VisualStudio.Text.PositionAffinity -> Microsoft.VisualStudio.Text.SnapshotPoint
Public Function MapToSourceSnapshot (position As Integer, affinity As PositionAffinity) As SnapshotPoint

Parameters

position
Int32

The position in the projection snapshot .

affinity
PositionAffinity

If the mapping is ambiguous (the position lies on a source span seam), this parameter affects the mapping as follows: if affinity is Predecessor, the mapping targets the position immediately after the preceding character in the projection buffer; if affinity is Successor, the mapping targets the position immediately before the following character in the projection buffer. This parameter has no effect if the mapping is unambiguous.

Returns

A snapshot point in one of the source snapshots.

Exceptions

position is less than zero or greater than or equal to the length of the snapshot.

The projection snapshot has no source spans.

Remarks

In general, a source span seam occurs at the end of a source span of nonzero length and the beginning of a source span of nonzero length, and coincides with zero or more source spans of zero length.

Applies to