Condividi tramite


ITextSearchService2.Find Method (SnapshotSpan, SnapshotPoint, String, FindOptions)

Searches for the next occurrence of the given search pattern, using the given search range, starting position and options.

Namespace:  Microsoft.VisualStudio.Text.Operations
Assembly:  Microsoft.VisualStudio.Text.Logic (in Microsoft.VisualStudio.Text.Logic.dll)

Syntax

'Declaration
Function Find ( _
    searchRange As SnapshotSpan, _
    startingPosition As SnapshotPoint, _
    searchPattern As String, _
    options As FindOptions _
) As Nullable(Of SnapshotSpan)
Nullable<SnapshotSpan> Find(
    SnapshotSpan searchRange,
    SnapshotPoint startingPosition,
    string searchPattern,
    FindOptions options
)
Nullable<SnapshotSpan> Find(
    SnapshotSpan searchRange, 
    SnapshotPoint startingPosition, 
    String^ searchPattern, 
    FindOptions options
)
abstract Find : 
        searchRange:SnapshotSpan * 
        startingPosition:SnapshotPoint * 
        searchPattern:string * 
        options:FindOptions -> Nullable<SnapshotSpan> 
function Find(
    searchRange : SnapshotSpan, 
    startingPosition : SnapshotPoint, 
    searchPattern : String, 
    options : FindOptions
) : Nullable<SnapshotSpan>

Parameters

  • searchPattern
    Type: String

    [in] The text pattern to search for.

Return Value

Type: Nullable<SnapshotSpan>
This method is safe to be executed on any thread.
Returns the text span containing the match if a match was found; otherwise, returns nulla null reference (Nothing in Visual Basic) if no matches were found.

Remarks

ArgumentException if the UseRegularExpressions option is set and the search string is an invalid regular expression.

.NET Framework Security

See Also

Reference

ITextSearchService2 Interface

Find Overload

Microsoft.VisualStudio.Text.Operations Namespace