the session collection only holds objects, to use an object as an array you
need to cast it:
((string[]) Session["MY_SESVAR"])[j] = "some string";
though this will still blow if there is no session, you should try something
like:
string[] myStrings = Session["MY_SESVAR"] as string[];
if (myStrings == null)
setupSession();
else
myStrings[j] = "some string";
-- bruce (sqlwork.com)
"klynn" <kl***@discussions.microsoft.com> wrote in message
news:22**********************************@microsof t.com...
I defined a session variable as an array using Session["MY_SESVAR"] = new
string[200];
Later, in my code, I need to set it and sort it.
I tried Session["MY_SESVAR"][j] = "some string";
My error is "Cannot apply indexing with [] to an expression of type
'object'.
Then, later, I try to use it, and sort on it an get 'cannot convert from
'object' to System.array.
what am I doing wrong here?