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
G van Damn
NA
4
0
Preventing duplicate code in different for loops
Jan 3 2011 12:42 PM
I've got a class, let's say a "mutual fund portfolio". It's got 3 methods that calculate 3 different numbers each using a for-loop. Most of the steps in the 3 different methods are exactly the same, except for 1 or 2 steps.
Is there a smarter way to prevent duplicate code than just writing 1 base method and using a case statement for the 3 different numbers to be calculated?
(I hope the description is clear enough.)
Reply
Answers (
3
)
adding items to a combo box depending upon the value given
I Cannot store strings in jagged Array