Tell us what are the Difference between ViewBag&ViewData?
Submitted by: Muhammad☛ ViewData is a dictionary of objects that is derived from ViewDataDictionary class and accessible using strings as keys.
☛ ViewBag is a dynamic property that takes advantage of the new dynamic features in C# 4.0.
☛ ViewData requires typecasting for complex data type and check for null values to avoid error.
☛ ViewBag doesn't require typecasting for complex data type.
Calling of ViewBag is:
ViewBag.Name = "Hasan";
Calling of ViewData is :
ViewData["Name"] = " Hasan ";
Submitted by: Muhammad
☛ ViewBag is a dynamic property that takes advantage of the new dynamic features in C# 4.0.
☛ ViewData requires typecasting for complex data type and check for null values to avoid error.
☛ ViewBag doesn't require typecasting for complex data type.
Calling of ViewBag is:
ViewBag.Name = "Hasan";
Calling of ViewData is :
ViewData["Name"] = " Hasan ";
Submitted by: Muhammad
Read Online MVC Developer Job Interview Questions And Answers
Top MVC Developer Questions
☺ | Tell me in which assembly is the MVC framework is defined? |
☺ | Explain what are Filters in MVC? |
☺ | Tell us attribute based routing in MVC? |
☺ | Suppose if we have multiple filters, what’s the sequence for execution? |
☺ | Tell us what are the Difference between ViewBag&ViewData? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |