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
Alok Pandey
NA
8.3k
6.8m
How to count total number of occurrence
Jan 12 2012 11:07 PM
Hi,
I am using arraylist, in which I have added some number. I want to count total number of occurrences of number? Like,
ArrayList ar=new Arraylist();
ar.Add(2);ar.Add(3);ar.Add(3);ar.Add(2);ar.Add(2);ar.Add(7);ar.Add(2);ar.Add(2);
Output should be like this. 2 - 5 times
3 - 2 times
7 - 1 times
Is there any method which can solve this problem without writing full code or I have to take all numbers and check with all remaining numbers? Please help me.
Thanks in advance.
Reply
Answers (
2
)
Var and object in C#
Reporing in c# windows application