mvc model 传值两种方式区别

1:

controller中:

public actionresult index()

{

M m=new M();

return view(m)

}

view中:

@model.phone 

vs 中 phone 不能自动识别

2:

public actionresult index()

{

return view()

}

view中:

@{

M m=new M();

}

@m.phone

这时phone 可以通过智能感知功能显示,相比第一种要简便。

原文地址:https://www.cnblogs.com/jinzhaoyoujiu/p/view-model.html