InvalidCastException

G

Gary Wardell

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
 
G

Gary Wardell

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top