ASP.NET MVC Interview Questions Part-3
What is Dependency Injection?
Dependence injection means injecting the dependent object by some one else rather than creating himself .
How can we read configuration data from appsettings.json?
By using IConfiguration object.
What is the need of viewdata?
Viewdata helps us to transfer data from controller to the view.
Example: ViewData["vi"]='' abc''

What is the difference between Viewdata and Viewbag?
Viewbag is similar to the Viewdata .
It is used to transfer data from controller to view.
Viewbag is nothing but syntactic sugar over Viewdata.
Typecasting, Null checks are not required.
Example: ViewBag.vi
Viewdata helps us to transfer data from controller to the view.
Typecasting, Null checks are required.
Syntax: ViewData["vi"]=''abc''
For more understanding watch below video :
No comments:
Post a Comment