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
y s
NA
2.6k
26.4k
compare 2 keys to get value
Mar 30 2011 8:03 AM
I have an arrayList with key which are shown below:
1
2
3
1 2
1 3
3 1
2 3
1 2 3
2 3 1
I have another sortesList with key and value which shown below:
1:4
2:4
3:4
1 2:3
1 3:3
2 3:4
1 2 3:4
if the key in arrayList which is same with the key in sortedlist,
then will come out the value.
my expected output is :
1:4
2:4
3:4
1 2:3
1 3:3
2 3:4
1 2 3:4
2 3 1:4
how i compare this 2 keys and display it in another new sortedList?
Hope someone can help me. my coding are shown below:
ArrayList arryKey = new ArrayList();
double v;
foreach (String key1 in sortList2.Keys)
{
arryKey.Add(key1);
foreach (String key in arryKey)
{
if (sortList.ContainsKey(key))
{
sortList.TryGetValue(key1, out v);
richTextBox5.AppendText(key1 + " " + v +"\n");
}
}
}
Reply
Answers (
16
)
Intersection for Two List problem
Checking how long a C# label can be seen