I’m using the template in Visual Studio 2022 for a .NET MAUI Blazor Hybrid App. I have created a new razor component and I want to use IEnumerable which is part of System.Collections
I know that I need to use this code using System.Collections;
– but where do I put it?
In the latest project template there is no data folder, which is where a service would typically be defined. Looking at the weather component included in the latest version of the template, all C# code for a component is placed within a @code {}
block at the bottom of the component. I don’t seem to be able to place using System.Collections;
anywhere inside the razor component.
I tried to place using System.Collections;
in MauiProgram.cs, but this seems to be out of scope and I still get an error in my razor component.
How can I add the namespace for use in my razor component? Is the problem that I need to create a data folder like in older versions of this project template?