Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can anyone tell me what is the main difference between @using and @Model in Mvc in view ,what is required when

Tags:

asp.net

I am new to Asp.Net and MVC as such . The one thing that keeps confusing me is that we use @Using and @Model in our views sometimes , i need more clarity on what is required when and why.

like image 341
Jithesh Chandra Avatar asked Jan 13 '23 08:01

Jithesh Chandra


1 Answers

@using is the same as as the the using directive in normal C# code: it gives access to Types of a Namespace without having to explicitly stating it.

@model defines the type of the Model for the view (or partial), allowing typed access to it and it's members.

@Modelaccesses the model linked with this view in the current call, as in the actual Data.

like image 85
ramsesoriginal Avatar answered May 25 '23 18:05

ramsesoriginal