本文整理汇总了C#中Diagnostic.GetSuppressionInfo方法的典型用法代码示例。如果您正苦于以下问题:C# Diagnostic.GetSuppressionInfo方法的具体用法?C# Diagnostic.GetSuppressionInfo怎么用?C# Diagnostic.GetSuppressionInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Diagnostic
的用法示例。
在下文中一共展示了Diagnostic.GetSuppressionInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAsync
public static async Task<RemoveSuppressionCodeAction> CreateAsync(
SuppressionTargetInfo suppressionTargetInfo,
Document document,
Diagnostic diagnostic,
AbstractSuppressionCodeFixProvider fixer,
CancellationToken cancellationToken)
{
var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
var attribute = diagnostic.GetSuppressionInfo(compilation).Attribute;
if (attribute != null)
{
return AttributeRemoveAction.Create(attribute, document, diagnostic, fixer);
}
else
{
return PragmaRemoveAction.Create(suppressionTargetInfo, document, diagnostic, fixer);
}
}
开发者ID:nemec,项目名称:roslyn,代码行数:18,代码来源:AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.cs
示例2: CreateAsync
public static async Task<RemoveSuppressionCodeAction> CreateAsync(
SuppressionTargetInfo suppressionTargetInfo,
Document documentOpt,
Project project,
Diagnostic diagnostic,
AbstractSuppressionCodeFixProvider fixer,
CancellationToken cancellationToken)
{
var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
var attribute = diagnostic.GetSuppressionInfo(compilation).Attribute;
if (attribute != null)
{
return AttributeRemoveAction.Create(attribute, project, diagnostic, fixer);
}
else if (documentOpt != null && !SuppressionHelpers.IsSynthesizedExternalSourceDiagnostic(diagnostic))
{
return PragmaRemoveAction.Create(suppressionTargetInfo, documentOpt, diagnostic, fixer);
}
else
{
return null;
}
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:23,代码来源:AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.cs