IProjectionSnapshot.MapToSourceSnapshot Method (Int32, PositionAffinity)
Maps a position in the projection snapshot to the corresponding position in a source snapshot.
Namespace: Microsoft.VisualStudio.Text.Projection
Assembly: Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)
Syntax
'Declaration
Function MapToSourceSnapshot ( _
position As Integer, _
affinity As PositionAffinity _
) As SnapshotPoint
SnapshotPoint MapToSourceSnapshot(
int position,
PositionAffinity affinity
)
SnapshotPoint MapToSourceSnapshot(
int position,
PositionAffinity affinity
)
abstract MapToSourceSnapshot :
position:int *
affinity:PositionAffinity -> SnapshotPoint
function MapToSourceSnapshot(
position : int,
affinity : PositionAffinity
) : SnapshotPoint
Parameters
position
Type: Int32The position in the projection snapshot .
affinity
Type: Microsoft.VisualStudio.Text.PositionAffinityIf 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.
Return Value
Type: Microsoft.VisualStudio.Text.SnapshotPoint
A snapshot point in one of the source snapshots.
Exceptions
Exception | Condition |
---|---|
ArgumentOutOfRangeException | position is less than zero or greater than or equal to the length of the snapshot. |
InvalidOperationException | 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. Every span on a seam has a point in the result collection.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.