I don't see why you're so stuck on 2d arrays. The dictionary lets you do all the lookups.
Code:
static void Main(string[] args)
{
Dictionary<string, int> colorAmounts = new Dictionary<string, int>();
colorAmounts.Add("green", 4);
colorAmounts.Add("red", 12);
colorAmounts.Add("blue", 7);
Dictionary<string, string> geneotypes = new Dictionary<string, string>();
geneotypes.Add("fluffy", "green");
geneotypes.Add("bunny", "red");
geneotypes.Add("feet", "blue");
int totalChildren = colorAmounts.Sum(c => c.Value); // 4 + 12 + 7 in this example
foreach (string type in geneotypes.Keys)
{
string color = geneotypes[type];
Console.WriteLine("Geneotype: {0}, Color: {1}, Percent: {2}%", type, color, (double)colorAmounts[color] / totalChildren * 100);
}
}
Code:
Geneotype: fluffy, Color: green, Percent: 17.3913043478261%
Geneotype: bunny, Color: red, Percent: 52.1739130434783%
Geneotype: feet, Color: blue, Percent: 30.4347826086957%
Press any key to continue . . .