diff --git a/src/SourceGenerators/Bit.SourceGenerators/Blazor/BlazorSetParametersSourceGenerator.cs b/src/SourceGenerators/Bit.SourceGenerators/Blazor/BlazorSetParametersSourceGenerator.cs index 74303402db..60f414ab60 100644 --- a/src/SourceGenerators/Bit.SourceGenerators/Blazor/BlazorSetParametersSourceGenerator.cs +++ b/src/SourceGenerators/Bit.SourceGenerators/Blazor/BlazorSetParametersSourceGenerator.cs @@ -56,10 +56,9 @@ public override Task SetParametersAsync(ParameterView parameters) //{ // source.AppendLine($" {property.PropertySymbol.Name}HasBeenSet = false;"); //} - source.AppendLine(" var parametersDictionary = parameters.ToDictionary() as Dictionary;"); - source.AppendLine(" foreach (var parameter in parametersDictionary!)"); + source.AppendLine(" foreach (var parameter in parameters)"); source.AppendLine(" {"); - source.AppendLine(" switch (parameter.Key)"); + source.AppendLine(" switch (parameter.Name)"); source.AppendLine(" {"); // create cases for each property @@ -71,7 +70,6 @@ public override Task SetParametersAsync(ParameterView parameters) // source.AppendLine($" {bitProperty.PropertySymbol.Name}HasBeenSet = true;"); //} source.AppendLine($" {bitProperty.PropertySymbol.Name} = parameter.Value is null ? default! : ({bitProperty.PropertySymbol.Type.ToDisplayString()})parameter.Value;"); - source.AppendLine(" parametersDictionary.Remove(parameter.Key);"); source.AppendLine(" break;"); } @@ -84,7 +82,7 @@ public override Task SetParametersAsync(ParameterView parameters) } else { - source.AppendLine(" return base.SetParametersAsync(ParameterView.FromDictionary(parametersDictionary as IDictionary));"); + source.AppendLine(" return base.SetParametersAsync(parameters);"); } source.AppendLine(" }");