我有以下代碼: 但我不能迴應寫在列表中的值用於調試目的...無法看到在C#中從列表中的值
public void LottoWinners(object sender, EventArgs e)
{
Dictionary<int, int> number = new Dictionary<int, int>();
Random generator = new Random();
while (number.Count < 6)
{
number[generator.Next(1, 49)] = 1;
}
int[] lotto = number.Keys.OrderBy(n => n).ToArray();
List<int> lst = lotto.OfType<int>().ToList();
StringBuilder builder = new StringBuilder();
for (int i = 0; i < lst.Count; i++) // Loop through List with for
{
builder.Append(lst).Append("|"); // Append string to StringBuilder
}
string result = builder.ToString(); // Get string from StringBuilder
Response.Write(result);
}
但我看到的是我的結果。我應該看到我的名單的價值!
System.Collections.Generic.List`1
對於'Join()'+1。 – RichieHindle
+1 ...它的工作..謝謝... – PriceCheaperton
Downvoter關心評論請? – Zbigniew