C
Cramer
Using ASP.NET 3.5...
As far as I know, any time we store a value in application or session state,
it is stored as a humble 'object' type rather than it's "real" type.
For example, if we want to store an integer value in Application state:
Application["MyInt"] = 93;
Then to retrieve that value, we would use something like this:
Convert.ToInt32(Application["MyInt"]);
My question:
Is there any way we can retrieve the value of "MyInt" as an integer -
without having to convert it first from 'object'?
I'm aware of extension methods - but what about "extension properties"? Or
am I missing something that should be obvious?
Thanks.
As far as I know, any time we store a value in application or session state,
it is stored as a humble 'object' type rather than it's "real" type.
For example, if we want to store an integer value in Application state:
Application["MyInt"] = 93;
Then to retrieve that value, we would use something like this:
Convert.ToInt32(Application["MyInt"]);
My question:
Is there any way we can retrieve the value of "MyInt" as an integer -
without having to convert it first from 'object'?
I'm aware of extension methods - but what about "extension properties"? Or
am I missing something that should be obvious?
Thanks.