ASP.NET C# Application Object Getters and Setters

Posted by kellax on Stack Overflow See other posts from Stack Overflow or by kellax
Published on 2012-11-04T21:21:18Z Indexed on 2012/11/05 5:00 UTC
Read the original article Hit count: 215

Filed under:
|
|
|

I have had a hard time finiding a newbie friendly example of accessing Application Object. I have few things ( arrays ) i would like to store in Application Object to keep as persistant data for about 2h till AppRecycle

Anyhow i know how to set an Application Object variable this way:

// One way
String[] users = new String[1000];
Application["users"] = users;

// Another way
Application.Add("users", users);

However i do not know how to access these variables once in Application Object there is a Getter method Get however it requires int index and other one Contents which get's everything.

Here i try to retrive my String[] array but gives me a error that i am trying to convert Object to String.

String[] usersTable = Application["users"];
// Since this is an object i also tried Application.users but gives error

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET