Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ASP.NET MVC 3 では、どちらを使用するのがより正しいですJson()かnew JsonResult()? どちらも同じ結果を返します。オフィスでの議論の解決にご協力いただきありがとうございます。
Json()
new JsonResult()
Json()は、実際にオブジェクトをバックグラウンドで返す拡張メソッドですJsonResult(コンストラクターを直接呼び出す必要はありません)。
JsonResult
私はほとんどの場合、拡張メソッドを自分で使用します。View()これにより、、などのアクションメソッドからの他の一般的なリターンタイプとの整合性が高まりますPartialView()。
View()
PartialView()
また、作成するカスタムActionResultタイプの拡張メソッドも必ず作成してください。結局、それは個人的な好みの問題です。