TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Javed Iqbal
NA
21
6.6k
Dictionary keys printing problem
Sep 15 2014 3:47 AM
Why is this code printing the same 'key' once only?
Dictionary<int,string> dictionary = new Dictionary<int,string>();
var keys=new List<string>();
try
{
dictionary.Add(5, "javed");
dictionary.Add(5, "khan");
dictionary.Add(5, "javed");
}
catch (ArgumentException)
{
Console.WriteLine("Key/Value pair already used");
}
finally
{
foreach (int key in dictionary.Keys)
{
Console.WriteLine(key);
}
}
Reply
Answers (
1
)
Working with rating control in ajax toolkit
Import and Export Excel Files into SQL with C# ?