View: It contains the layout page. Before any view is rendered, viewstart page is rendered. View might have markup tags like body, html, head, title, meta etc. View is not lightweight as compare to Partial View. Partial View: It does not contain the layout page. Partial view does not verify for a viewstart.cshtml.We cannot put common code for a partial view within the viewStart.cshtml.page. Partial view is designed specially to render within the view and just because of that it does not consist any mark up. We can pass a regular view to the RenderPartial method.
There are total nine return types we can use to return results from controller to view. The base type of all these result types is ActionResult. ViewResult (View) : This return type is used to return a webpage from an action method. PartialviewResult (Partialview) : This return type is used to send a part of a view which will be rendered in another view. RedirectResult (Redirect) : This return type is used to redirect to any other controller and action method depending on the URL. RedirectToRouteResult (RedirectToAction, RedirectToRoute): This return type is used when we want to redirect to any other action method. ContentResult (Content) : This return type is used to return HTTP content type like text/plain as the result of the action. jsonResult (json): This return type is used when we want to return a JSON message. javascriptResult (javascript): This return type is used to return JavaScript code that will run in browser. FileResult (File): ...
Singleton : 1. Singleton class contains both static and non-static members 2. You can create instance of Singleton class. 3. You can implement inheritance. 4. You can clone a singleton class object. 5. Singleton class object creates in Heap memory. Static Class: 1. Static class contains only static members. 2. You can't create instance of Static class. 3. Once you declare a class as static you can't implement inheritance. 4. You can't clone static class object. 5. Static class object creates in stack memory.
Comments
Post a Comment