Partager via


IProjectionSnapshot.MapFromSourceSnapshot Method (SnapshotPoint, PositionAffinity)

Maps from a snapshot point in one of the source snapshots to the corresponding position in the projection snapshot.

Namespace:  Microsoft.VisualStudio.Text.Projection
Assembly:  Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)

Syntax

'Déclaration
Function MapFromSourceSnapshot ( _
    point As SnapshotPoint, _
    affinity As PositionAffinity _
) As Nullable(Of SnapshotPoint)
Nullable<SnapshotPoint> MapFromSourceSnapshot(
    SnapshotPoint point,
    PositionAffinity affinity
)
Nullable<SnapshotPoint> MapFromSourceSnapshot(
    SnapshotPoint point, 
    PositionAffinity affinity
)
abstract MapFromSourceSnapshot : 
        point:SnapshotPoint * 
        affinity:PositionAffinity -> Nullable<SnapshotPoint> 
function MapFromSourceSnapshot(
    point : SnapshotPoint, 
    affinity : PositionAffinity
) : Nullable<SnapshotPoint>

Parameters

  • 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 nulla null reference (Nothing in Visual Basic) if the source point does not correspond to text belonging to a span that is a member of the projection snapshot.

Exceptions

Exception Condition
ArgumentException

point does not belong to a source snapshot of this projection snapshot.

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

See Also

Reference

IProjectionSnapshot Interface

MapFromSourceSnapshot Overload

Microsoft.VisualStudio.Text.Projection Namespace