[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pnet-developers] [bugs #10335] Enumerator problem with SortedList.Keys
From: |
Dominique Canazzi |
Subject: |
[Pnet-developers] [bugs #10335] Enumerator problem with SortedList.Keys |
User-agent: |
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) |
This mail is an automated notification from the bugs tracker
of the project: DotGNU Portable.NET.
/**************************************************************************/
[bugs #10335] Full Item Snapshot:
URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=10335>
Project: DotGNU Portable.NET
Submitted by: Dominique Canazzi
On: jeu 09.09.2004 at 13:39
Category: None
Severity: 5 - Average
Item Group: None
Resolution: None
Privacy: Public
Assigned to: None
Status: Open
Summary: Enumerator problem with SortedList.Keys
Original Submission: foreach(), applied to the ICollection returned by the
Keys property of a SortedList, loses the first key.
Example:
using System;
using System.Collections;
namespace sl
{
class Class1
{
static void Main()
{
SortedList sl = new SortedList ();
sl.Add ("xxx", 1);
sl.Add ("aaa", 2);
sl.Add ("qqq", 3);
sl.Add ("hhh", 4);
foreach (String s in sl.Keys)
{
Console.WriteLine (s + " " + sl[s]);
}
Console.WriteLine ("---------------------------------");
IList kl = sl.GetKeyList ();
IList vl = sl.GetValueList ();
for (int i=0; i<sl.Count; i++)
{
Console.WriteLine (kl[i] + " " + vl[i]);
}
}
}
}
Should output:
aaa 2
hhh 4
qqq 3
xxx 1
---------------------------------
aaa 2
hhh 4
qqq 3
xxx 1
but outputs:
hhh 4
qqq 3
xxx 1
---------------------------------
aaa 2
hhh 4
qqq 3
xxx 1
Sorry for not proposing a fix, the pnetlib code is still a bit puzzling for me
:)
For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=10335>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Pnet-developers] [bugs #10335] Enumerator problem with SortedList.Keys,
Dominique Canazzi <=