How do you declare a dictionary called MyDic in the master page?
I want MyDic to hold lists of objects MyObj with a date as the key so that I can write something like this: “get the list for date 1/28/2011 from MyDic” or “put this list of MyObj from 1/28/2011 in MyDic”.
I’d like to declare the dictionary in the master page so that I can access it in every page.
Thanks.
How were you planning on persisting the list?
Instead of creating it in the master page, you could create it as an application variable, or if it is user-specific as a session variable. In either case you would do something like:
Then you would store it somewhere:
and when you need to access it again:
You could do the declaration in the Master Page on init or on load, or even better i would suggest doing it in the global.asax file for either session or application