1. Say suppose, you have a class
public class person {
public string Name {get;set;}
}
2. You are going to pass this class via a controller to the view and what you might do the the controller would be something similar
public ActionResult Index()
{
var _persons= _repo.GetPersons();
return view(_persons);
}
3. The class you have a declarative section something like - This is to tell your view that you are passing a class and the type is person - we use @model syntax
@model IEnumberable<person>
4. with in your view body, the class is available as "Model"
@foreach(var x in Model>
{
<div>@x.name</div>
}
Hope this sheds some light for you
Regards
Bala