IProjectionSnapshot::MapFromSourceSnapshot Method (SnapshotPoint, PositionAffinity)
Maps from a snapshot point in one of the source snapshots to the corresponding position in the projection snapshot.
Assembly: Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)
Nullable<SnapshotPoint> MapFromSourceSnapshot( SnapshotPoint point, PositionAffinity affinity )
Parameters
- point
-
Type:
Microsoft.VisualStudio.Text::SnapshotPoint
The snapshot point in a source buffer.
- affinity
-
Type:
Microsoft.VisualStudio.Text::PositionAffinity
If the mapping is ambiguous (the position lies between two source spans), 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: System::Nullable<SnapshotPoint>A position in the projection snapshot, or null if the source point does not correspond to text belonging to a span that is a member of the projection snapshot.
| Exception | Condition |
|---|---|
| ArgumentException | point does not belong to a source snapshot of this projection snapshot. |
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.