| 價值 | |
|---|---|
| 規則識別碼 | BL0003 |
| 類別 | 用法 |
| 修正是破壞性或非破壞性 | 中斷 |
原因
衍生自 ComponentBase 並由 CaptureUnmatchedValues= true 批註的型別上的參數不可從 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; }
}
隱藏警告的時機
請勿忽略此規則的警告。