Voila j'ai une fonction :
Qui marche quand size est à 4 mais qui plante quand il est a 8. Pourquoi?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 public List<string> Mot1() { List<string> list = new List<string>(); var alphabet = "abcdefghijklmnopqrstuvwxyz"; var q = alphabet.Select(x => x.ToString()); int size = 8; for (int i = 0; i < size - 1; i++) q = q.SelectMany(x => alphabet, (x, y) => x + y); foreach (var item in q) list.Add(item); return list; }
Aussi, est il possible de mettre la variable q en static et de parcourir cette liste, un par un, par une méthode à part. Si oui, comment?
Partager