Odd problem with System.Collections.SortedList 
Author Message
 Odd problem with System.Collections.SortedList

So I added a bunch of items to a sorted list. Now I can't access them,
when I try:

 foo[0]

it gives me the value, but when I try:

 int bar=0;
foo[bar]

it does it's thing with returning a null or something, but no break
for error; it gives me this error in the immediate window:

 {"Key cannot be null.
Parameter name: key" }
    System.ArgumentException: {"Key cannot be null.
Parameter name: key" }
    _nullMessage: null
    NullMessage: "Value cannot be null."

However also in the immediate window putting the literal value between
the brackets gives the correct answer



Thu, 28 Apr 2005 01:43:22 GMT  
 Odd problem with System.Collections.SortedList

Quote:

> So I added a bunch of items to a sorted list. Now I can't access them,
> when I try:

>  foo[0]

> it gives me the value, but when I try:

>  int bar=0;
> foo[bar]

> it does it's thing with returning a null or something, but no break
> for error; it gives me this error in the immediate window:

>  {"Key cannot be null.
> Parameter name: key" }
>     System.ArgumentException: {"Key cannot be null.
> Parameter name: key" }
>     _nullMessage: null
>     NullMessage: "Value cannot be null."

> However also in the immediate window putting the literal value between
> the brackets gives the correct answer

That seems very odd to me. Could you produce a short but complete console
application (no need for a GUI here) which demonstrates the problem?

--
Jon Skeet

If replying to the group, please do not mail me at the same time



Thu, 28 Apr 2005 08:29:47 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. SortedList Collection

2. Collections.SortedList

3. Problems with namespace System::Collections::Specialized

4. A collection inside a collection inside a collection...

5. 'System.Collections.IList.this[int]

6. ODD __gc problem

7. Very odd string problem

8. Odd ADSI Problem

9. Odd Setup Problems

10. Odd scanf problem

11. odd pointer dereference problem

12. Problem with odd loop when passing float to function

 

 
Powered by phpBB® Forum Software