Share via


Declarations.GetBestMatch Method

Determines the best completion match for the specified value.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)

Syntax

'Declaration
Public Overridable Sub GetBestMatch ( _
    value As String, _
    <OutAttribute> ByRef index As Integer, _
    <OutAttribute> ByRef uniqueMatch As Boolean _
)
public virtual void GetBestMatch(
    string value,
    out int index,
    out bool uniqueMatch
)
public:
virtual void GetBestMatch(
    String^ value, 
    [OutAttribute] int% index, 
    [OutAttribute] bool% uniqueMatch
)
abstract GetBestMatch : 
        value:string * 
        index:int byref * 
        uniqueMatch:bool byref -> unit  
override GetBestMatch : 
        value:string * 
        index:int byref * 
        uniqueMatch:bool byref -> unit
public function GetBestMatch(
    value : String, 
    index : int, 
    uniqueMatch : boolean
)

Parameters

  • value
    Type: System.String

    [in] The text to match against. This typically represents the text typed by the user.

  • index
    Type: System.Int32%

    [out] Returns the index of the item that best matches the value.

  • uniqueMatch
    Type: System.Boolean%

    [out] Returns true if the best match is the only match and it matches the value exactly; otherwise, returns false.

Remarks

This method is typically called from the GetBestMatch method in the CompletionSet class to determine which item in the IntelliSense completion list to highlight as characters are typed.

The base method calls the IsMatch method to look for a match. A unique match is indicated if the next item in the list does not match or the search is at the end of the list. If no match is found, index is set to the number of items in the list and uniqueMatch is set to true. If value is nulla null reference (Nothing in Visual Basic) or empty, a COMException exception is thrown.

.NET Framework Security

See Also

Reference

Declarations Class

Microsoft.VisualStudio.Package Namespace