Show object properties

circle-info

You can use dotnet watch and observe the result of code changes instantly on the browser!

Display properties of an object

circle-info

It is not recommended to declare classes in view code, they need to be declared in their respective Models directory or in page specific PageModel

@page

@{
    var joe = new Person()
    {
        Name = "Sam",
        Age = 25
    };
}
   
<p>Name: @joe.Name</p>
<p>Age: @joe.Age</p>

@functions{
    public class Person
    {        
        public string Name { get; set; }
        public int Age { get; set; }
    }
}

Display properties of a collection of objects

Last updated