je dois tracer tous les résultats Lorsque jetant quatre pièces à la foisrésultat possible en C#
public void TossCoin()
{
var coin1 = new string[]{ "Head", "Tail" };
var coin2 =new string[] { "Head", "Tail" };
var coin3 =new string[] { "Head", "Tail" };
var coin4 =new string[] { "Head", "Tail" };
var outcome =from first in coin1
from second in coin2
from third in coin3
from fourth in coin4
select new {possibility= coin1+","+coin2+","+coin3+","+coin4};
foreach (var oc in outcome)
{
Console.WriteLine(oc.possibility.ToString());
}
}
}
La sortie était
System.String [], ........... ....
Qu'est-ce qui n'a pas fonctionné?
Ceci est une autre question, lors de la sélection que je souhaite omettre {chef, chef, chef, chef} et {queue, queue, queue,} comment est-il possible? – Isuru
'où d'abord! = Seconde || deuxième! = troisième || troisième! = quatrième » – user7116