cannot see values from list in c#

Posted by PriceCheaperton on Stack Overflow See other posts from Stack Overflow or by PriceCheaperton
Published on 2013-06-30T10:17:31Z Indexed on 2013/06/30 10:21 UTC
Read the original article Hit count: 165

Filed under:
|

I have the following code: But i cannot response write the values in the list for debugging purposes...

 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);

    }

But all i see is as my result. I should be seeing the values of my list!

System.Collections.Generic.List`1

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET