本文整理汇总了C#中ImmutableDictionary.First方法的典型用法代码示例。如果您正苦于以下问题:C# ImmutableDictionary.First方法的具体用法?C# ImmutableDictionary.First怎么用?C# ImmutableDictionary.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImmutableDictionary
的用法示例。
在下文中一共展示了ImmutableDictionary.First方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
/// <summary>
/// Creates a new <see cref="FixMultipleContext"/>.
/// Use this overload when applying fix multiple diagnostics with a source location.
/// </summary>
/// <param name="diagnosticsToFix">Specific set of diagnostics to fix. Must be a non-empty set.</param>
/// <param name="codeFixProvider">Underlying <see cref="CodeFixes.CodeFixProvider"/> which triggered this fix all.</param>
/// <param name="codeActionEquivalenceKey">The <see cref="CodeAction.EquivalenceKey"/> value expected of a <see cref="CodeAction"/> participating in this fix all.</param>
/// <param name="cancellationToken">Cancellation token for fix all computation.</param>
public static FixMultipleContext Create(
ImmutableDictionary<Project, ImmutableArray<Diagnostic>> diagnosticsToFix,
CodeFixProvider codeFixProvider,
string codeActionEquivalenceKey,
CancellationToken cancellationToken)
{
var triggerProject = diagnosticsToFix.First().Key;
var diagnosticIds = GetDiagnosticsIds(diagnosticsToFix.Values);
var diagnosticProvider = new FixMultipleDiagnosticProvider(diagnosticsToFix);
return new FixMultipleContext(triggerProject, codeFixProvider, codeActionEquivalenceKey, diagnosticIds, diagnosticProvider, cancellationToken);
}
示例2: GetFix
public Solution GetFix(
ImmutableDictionary<Project, ImmutableArray<Diagnostic>> diagnosticsToFix,
Workspace workspace,
CodeFixProvider fixProvider,
FixAllProvider fixAllProvider,
string equivalenceKey,
string waitDialogTitle,
string waitDialogMessage,
CancellationToken cancellationToken)
{
var fixMultipleState = FixAllState.Create(fixAllProvider, diagnosticsToFix, fixProvider, equivalenceKey);
var triggerDiagnostic = diagnosticsToFix.First().Value.First();
var suggestedAction = GetSuggestedAction(fixMultipleState, triggerDiagnostic, workspace, waitDialogTitle, waitDialogMessage, showPreviewChangesDialog: false, cancellationToken: cancellationToken);
return suggestedAction.GetChangedSolution(cancellationToken);
}
示例3: GetFix
public Solution GetFix(
ImmutableDictionary<Document, ImmutableArray<Diagnostic>> diagnosticsToFix,
Workspace workspace,
CodeFixProvider fixProvider,
FixAllProvider fixAllProvider,
string equivalenceKey,
string waitDialogTitle,
string waitDialogMessage,
CancellationToken cancellationToken)
{
var fixMultipleState = FixAllState.Create(fixAllProvider, diagnosticsToFix, fixProvider, equivalenceKey);
var triggerDiagnostic = diagnosticsToFix.First().Value.First();
var result = GetFixedSolution(
fixMultipleState, triggerDiagnostic, workspace,
waitDialogTitle, waitDialogMessage, cancellationToken);
return result;
}
示例4: Create
internal static FixAllState Create(
FixAllProvider fixAllProvider,
ImmutableDictionary<Project, ImmutableArray<Diagnostic>> diagnosticsToFix,
CodeFixProvider codeFixProvider,
string codeActionEquivalenceKey)
{
var triggerProject = diagnosticsToFix.First().Key;
var diagnosticIds = GetDiagnosticsIds(diagnosticsToFix.Values);
var diagnosticProvider = new FixMultipleDiagnosticProvider(diagnosticsToFix);
return new FixAllState(
fixAllProvider,
triggerProject, codeFixProvider,
FixAllScope.Custom, codeActionEquivalenceKey,
diagnosticIds, diagnosticProvider);
}