| 值 | |
|---|---|
| 规则 ID | BL0003 |
| 类别 | 使用情况 |
| 修复是中断修复还是非中断修复 | 重大 |
原因
从用 CaptureUnmatchedValues= true 注释的 ComponentBase 派生的参数类型不能从 Dictionary<string, object> 进行分配
规则说明
用 CaptureUnmatchedValues = true 注释的参数必须能够接收 Dictionary<string, object> 值。
@code
{
[Parameter(CaptureUnmatchedValues = true)] public IDictionary<string, string> Attributes { get; set; }
}
如何解决冲突
将参数的类型更改为 IDictionary<string, object> 或 Dictionary<string, object>
@code
{
[Parameter(CaptureUnmatchedValues = true)] public IDictionary<string, object> Attributes { get; set; }
}
何时禁止显示警告
不禁止显示此规则发出的警告。