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
meetaligoel
NA
10
0
Generic Indexer - speed & safety issues
Nov 27 2003 10:01 AM
Hello, I'm currently working on a simple genetic algorithm where I have implemented the chromosomes as a class working as an indexer. The class holds a private array of type object representing the genes. I've done that to keep flexible with regards to using different representations (int, float, bits etc.). Now, because of that, the genes can be assigned different types (e.g. Genes 1-3 = int, Genes 4 - 5 = strings.) This is nice, but not desirable (accidental assignments of the wrong type may happen). I also suspect that this flexibility costs speed as the program has to juggle around the different types as and when they are assigned to the individual genes. Is this the case, and is there a reason for concern? Would I be better of defining a template (does that work in c#?) or just setting up a class with lots of overloaded methods (for the individual types)? Many thanks, N.
Reply
Answers (
2
)
Dynamic hyperlinks - how do i get rid of underline?
Getting Methods from an assembly