---
title: "Whatt's the difference between ViewData and ViewBag?"  
description: "Whatt's the difference between ViewData and ViewBag?"  
author: "Anonymous User"  
published: 2015-03-04  
updated: 2015-03-04  
canonical: https://www.mindstick.com/forum/12997/whatt-s-the-difference-between-viewdata-and-viewbag  
category: ".net"  
tags: ["mvc", "viewbag", "viewdata"]  
reading_time: 1 minute  

---

# Whatt's the difference between ViewData and ViewBag?

I saw the [ViewBag](https://www.mindstick.com/forum/155739/define-viewbag-in-mvc) in [MVC](https://www.mindstick.com/forum/155803/define-cache-profile-in-mvc) 3. How's that different than [ViewData](https://www.mindstick.com/forum/12798/there-is-no-viewdata-item-of-type-ienumerable-selectlistitem-that-has-the-key-username) in MVC 2?

## Replies

### Reply by Anonymous User

**ViewData & ViewBag objects**

**\****· ViewData**

## \

ViewData is a dictionary object that you put data into, which then becomes available to the view. ViewData is a derivative of the ViewDataDictionary class, so you can access by the familiar "key/value" syntax.

## · ViewBag

The ViewBag object is a wrapper around the ViewData object that allows you to create dynamic properties for the ViewBag.


---

Original Source: https://www.mindstick.com/forum/12997/whatt-s-the-difference-between-viewdata-and-viewbag

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
