资产 | 价值 |
---|---|
规则 ID | IDE3000 |
标题 | 使用 Copilot 实现 |
类别 | CodeQuality |
子类别 | 其他规则 |
适用的语言 | C#(编程语言) |
概述
此规则标识包含 NotImplementedException 的方法,并提供使用 GitHub Copilot 实现该方法的建议。 使用此代码修复时,GitHub Copilot 会基于方法的签名、类型上下文和其他可用信息生成方法的实现。
注释
即使你在构建时启用代码样式规则,也不会启用此规则。 它仅显示在 IDE 中。
选项
此规则没有关联的代码样式选项。
示例:
// Code with NotImplementedException
public class Calculator
{
public int Add(int a, int b)
{
// IDE3000: Implement with Copilot.
throw new NotImplementedException();
}
}
单击灯泡建议时,请选择 “使用 Copilot 实现 ”选项,提示 GitHub Copilot 为该方法生成实现。
抑制警告
如果只想取消单个冲突,请将预处理器指令添加到源文件以禁用,然后重新启用规则。
#pragma warning disable IDE3000
// The code that's violating the rule is on this line.
#pragma warning restore IDE3000
若要禁用文件、文件夹或项目的规则,请在none
中将其严重性设置为。
[*.{cs,vb}]
dotnet_diagnostic.IDE3000.severity = none
若要禁用所有代码样式规则,请在Style
中将类别none
的严重性设置为。
[*.{cs,vb}]
dotnet_analyzer_diagnostic.category-Style.severity = none
有关详细信息,请参阅如何禁止显示代码分析警告。