dotnet/roslyn

"Add Constraints" Code-Fix

开放

#50,479 创建于 2021年1月14日

 (1 条评论) (0 个反应) (0 位负责人)C# (4,257 个派生)batch import
Area-IDEIDE-CodeStylehelp wanted

仓库指标

星标
 (20,414 个星标)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

Brief description: When working with a generic class, it would be nice if I could run a code-fix to automatically add missing constraints from a base class.

Languages applicable: All languages

Code example that the analyzer should report:

public class Derived<TKey, TJson, TStorage> : base<TKey, TJson, TStorage> {

}

 public abstract class Base<TKey, TJson, TStorage>
        where TKey : notnull
        where TJson : JsonBase<TKey>, new()
        where TStorage : StorageBase<TKey, TJson>, new()
        {

}

Additional information: None.

Documentation requirements:

When this analyzer is implemented, it must be documented by following the steps at Documentation for IDE CodeStyle analyzers.

贡献者指南