Closed Menelion closed 1 year ago
In Exercise — Share data in Blazor Applications there is a ConfigurePizzaDialog.razor file where there is this line and lines below:
<h2>@Pizza.Special.Name</h2> @Pizza.Special.Description
VS Code complains:
An object reference is required for the non-static field, method, or property 'Pizza.Special' [BlazingPizza]
If however I set it to static, I get complains for index.razor:
static
configuringPizza = new Pizza() { Special = special, SpecialId = special.Id, Size = Pizza.DefaultSize };
It says (obviously) it cannot set a static property on a class instance.
What is the solution to this problem? Thanks.
Mea culpa. I missed the @code{} directive on the next step:
@code{}
@code { [Parameter] public Pizza Pizza { get; set; } }
In Exercise — Share data in Blazor Applications there is a ConfigurePizzaDialog.razor file where there is this line and lines below:
VS Code complains:
If however I set it to
static
, I get complains for index.razor:It says (obviously) it cannot set a static property on a class instance.
What is the solution to this problem? Thanks.