IProjectionSnapshot::MapToSourceSnapshot Method (Int32, PositionAffinity)
Maps a position in the projection snapshot to the corresponding position in a source snapshot.
Assembly: Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)
Parameters
- position
-
Type:
System::Int32
The position in the projection snapshot .
- affinity
-
Type:
Microsoft.VisualStudio.Text::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.
Return Value
Type: Microsoft.VisualStudio.Text::SnapshotPointA snapshot point in one of the source snapshots.
| 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. |
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.