.net question

    ASP.NET MVC Interview Question

    1. What is EmptyResult in MVC?

    EmptyResult is used when you want to execute logic return inside the controller action method but does not want any result back to the view.

    2. What is difference between returning EmptyResult and Null?

    There is no functional difference between both. When we return NULL then also it return EmptyResult internally.

    We should use EmptyResult as it communicates more clearly that your action returns nothing.

    3. Can we overload controller methods in ASP.NET MVC?

    We can use ActionName attribute to overload action method.

            public ActionResult LoadCustomer()
                return Content("LoadCustomer");
            public ActionResult LoadCustomer(string str)
                return Content("LoadCustomer with a string");
    May 2, 2018 0 comment
    0 Facebook Twitter Google + Pinterest