共用方式為


IFileContextProvider.GetContextsForFileAsync Method

Definition

Finds contexts for a given file.

public:
 System::Threading::Tasks::Task<System::Collections::Generic::IReadOnlyCollection<Microsoft::VisualStudio::Workspace::FileContext ^> ^> ^ GetContextsForFileAsync(System::String ^ filePath, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Microsoft.VisualStudio.Workspace.FileContext>> GetContextsForFileAsync (string filePath, System.Threading.CancellationToken cancellationToken);
abstract member GetContextsForFileAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<Microsoft.VisualStudio.Workspace.FileContext>>
Public Function GetContextsForFileAsync (filePath As String, cancellationToken As CancellationToken) As Task(Of IReadOnlyCollection(Of FileContext))

Parameters

filePath
String

The file workspace being passed

cancellationToken
CancellationToken

A token whose cancellation should terminate the search.

Returns

A task whose result is collection of contexts that the file belongs to. The collection should never be null, but it may be empty.

Remarks

A file may belong to contexts that are not discoverable on-demand with this method.

Applies to