Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > InvalidCastException

Reply
Thread Tools

InvalidCastException

 
 
Gary Wardell
Guest
Posts: n/a
 
      07-17-2008
Hi,

This doesn't seem to work. It throws an InvalidCastException.
In general, when I'm trying to enumerate something, how do I find what type
of object the enumerator returns? Help doesn't seem to be much help in this
regard.

Specifically, what type of object does the Session enumerator return?
int i = 0;
foreach (DictionaryEntry var in Session)
{
OutputBuffer =+ string.Format("(0) Key={1}, Value={2}", i, var.Key,
var.Value);
i++;
}

Gary


 
Reply With Quote
 
 
 
 
Gary Wardell
Guest
Posts: n/a
 
      07-17-2008
Hi,

Thanks, that helped.

I was looking to iterate the keys and values. That gave the keys. I was
expecting both in the same object.

Gary


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"System.InvalidCastException: Specified cast is not valid." during connection.open Roy Lawson ASP .Net 12 10-25-2004 05:42 PM
User Control - InvalidCastException: Specified cast is not valid Ajit ASP .Net 1 04-24-2004 09:28 PM
PRB: Error Message: System.InvalidCastException: Specified Cast Is Not Valid Miguel Angel Dinelli ASP .Net 1 11-13-2003 07:56 PM
System.InvalidCastException: Specified cast is not valid. Arjen ASP .Net 1 08-06-2003 03:26 AM
System.InvalidCastException: Specified cast is not valid Floela ASP .Net 3 07-10-2003 10:36 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57