我正在做抽獎,用戶輸入獎品並出售票。每張票都有一個買主,他的名字,電話等等。我已經離開了,我們要抽出一張中獎票,並分配獎品它:從容器中抽取一張隨機票
{
private Random draw = new Random();
private List<Ticket> ticketContainer = new List<Ticket>();
private List<Prize> prizes = new List<Prize>();
public List<Prize> DoDraw()
{
int ticketCount = ticketContainer.Count;
foreach (var prize in prizes)
{
int ticketNumber = draw.Next(1, ticketCount + 1);
}
return prizes;
Console.WriteLine(prizes);
}
我有這樣的代碼,但是當我運行它沒有happens.Ive一直在尋找,並試圖找到答案,但一直停留2天,我triend幾個方面。