ASP.NET MVC Razor, Html.BeginForm, using statement
问题 For an ASP.NET MVC application, can someone explain to me why calls to Html.BeginForm begin with the statement @using ? Example - @using (Html.BeginForm()) { //Stuff in the form } I thought @using statements are for including namespaces. Thanks! 回答1: Using Statement provides a convenient syntax that ensures the correct use of IDisposable objects. Since the BeginForm helper implements the IDisposable interface you can use the using keyword with it. In that case, the method renders the closing