I'm trying some examples of Blazor client-side application like showed on Microsoft web site. I have implemented a ToDoItem class in a file .cs and I use this class in my .razor file. VS 2019 mark as "could not be found" the reference to the class ToDoItem and AddToDo method in the .razor file, but the code is compilable and the application run correctly. I have the same problem if I use a reference to the UIMouseEventArgs. How can I avoid this marks?

public class ToDoItem
    public string Title { get; set; }
    public bool IsDone { get; set; }

``` Razor page code
``` ...
<button onclick="@AddToDo">Add todo</button>

@functions {

    private string newTodo;
    private IList<ToDoItem> todos = new List<ToDoItem>();

    private void AddToDo()
        if (!string.IsNullOrEmpty(newTodo))
            todos.Add(new ToDoItem
                Title = newTodo,
                IsDone = false

            newTodo = string.Empty;

[Screnshot of VS2019][1]

  [1]: https://i.stack.imgur.com/1mHtT.png

Sorry found the problem: I need to add the using clausole
@using BlazorFirstApp.Pages

0 Answers