Closed FrediKats closed 5 years ago
The Gene is not generic because a chromosome could be made for genes of different kind o values: int, float, double, char, any type o class.
If you made it generic will have problems with simple things, like this method on the IChromosome interface:
/// <summary>
/// Gets the genes.
/// </summary>
/// <returns>The genes.</returns>
Gene[] GetGenes();
The Gene is not generic because a chromosome could be made for genes of different kind o values: int, float, double, char, any type o class.
If you made it generic will have problems with simple things, like this method on the IChromosome interface:
/// <summary> /// Gets the genes. /// </summary> /// <returns>The genes.</returns> Gene[] GetGenes();
maybe return List\<T> then, where T : IGene
Struct Gene isn't generic. It's probably not type-safed.
First solution