Hi Guys
I ran into a bit of a problem with some code I am writing. I am trying to store all possible combinations of a set of numbers which are current being stored in List. Problem is my code run into an out of memory exception, heres my code:
public void GetAllPossibleCombos(Dictionary<int, decimal> numbers)
{
var allNumbers = numbers.Keys.ToArray();
var possibleLines = new List<Line>();
Combinations<int> normalCombo = new Combinations<int>(allNumbers, 5);
foreach(IList<int> n in normalCombo)
{
var line = new Line();
line.Number1 = n[0];
line.Number2 = n[1];
line.Number3 = n[2];
line.Number4 = n[3];
line.Number5 = n[4];
possibleLines.Add(line);
}
}
}
The dictionary has 50 numbers, the Combinations method was something I found on CSharpCorner. Dont know if anyone has any ideas. Cheers.