title: Get value of certain index in list C#
body: <p>I want to get value of a certain index on my list how can do that? I have here a method that returns List of Games:</p>
  
  <pre><code>public static List&lt;BO.Game&gt; GetGames()
      {
          List&lt;BO.Game&gt; listGame = new List&lt;BO.Game&gt;();
  
          BO.Game game;
  
  
  
          SqlConnection con = new SqlConnection();
  
          try
          {
              con.ConnectionString = connectionString;
              con.Open();
  
              SqlCommand com = new SqlCommand();
              com.Connection = con;
              com.CommandType = CommandType.StoredProcedure;
              com.CommandText = "GetDisplayPicOfContest";
  
              SqlDataReader dr = com.ExecuteReader();
  
              while (dr.Read())
              {
                  game = new BO.Game();
                  game.PrizeID = Convert.ToInt32(dr["PrizeID"]);
                  game.Name = dr["LocationName"].ToString();
                  game.ImageURL = "DisplayImages/" + dr["DisplayImage"].ToString();
                  game.Country = dr["CountryName"].ToString();
                  listGame.Add(game);
              }
  
  
              dr.Close();
              dr.Dispose();
  
  
          }
          catch (Exception ex)
          {
              throw ex;
          }
          finally
  
          {
              con.Close();
              con.Dispose();
          }
  
          return listGame;
      }
  </code></pre>
  
  <p>For example I want to display the image url of the first and second item on the list</p>
  
  <p>can I do something like this?</p>
  
  <pre><code>&lt;div id="mcont2-sub1" class="mcont-subs mcont-subs-2"&gt;
                      &lt;div class="full-detais-cover2"&gt;
  
                          &lt;a class="opac-link" href="game_details.html" &gt;&lt;img  class="hover-img-main" src="&lt;%=listGames[0].ImageURL;%&gt;" /&gt;&lt;/a&gt;
  
                          &lt;a class="opac-link" href="game_details.html" &gt;&lt;div id="cover-pager2"&gt;&lt;img src="Images/lens-full-details.png" /&gt;&lt;/div&gt;&lt;/a&gt;
                          &lt;div class="ticket-quantity2"&gt;
                          &lt;span&gt;Choose ticket quantity&lt;/span&gt;&lt;span&gt;Tickets $5.00&lt;/span&gt;
                              &lt;ul class="quantity-paging"&gt;
                                  &lt;li&gt;&lt;a&gt;&amp;nbsp;1&amp;nbsp;&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a&gt;&amp;nbsp;2&amp;nbsp;&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a&gt;&amp;nbsp;3&amp;nbsp;&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a&gt;&amp;nbsp;4&amp;nbsp;&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a&gt;&amp;nbsp;5&amp;nbsp;&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a&gt;10&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a&gt;15&lt;/a&gt;&lt;/li&gt;
                                  &lt;li&gt;&lt;a&gt;20&lt;/a&gt;&lt;/li&gt;
                              &lt;/ul&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="descrip-place" id="id-descrip-place"&gt;
                          &lt;p class="description"&gt;Marbella Beach Club Marriott&lt;/p&gt;
                          &lt;p class="place"&gt;Spain&lt;/p&gt;
                      &lt;/div&gt;
                      &lt;a  href="game_details.html" class="arrow-light-blue" &gt;&lt;img src="Images/arrow-light-blue.png" /&gt;&lt;/a&gt;
                  &lt;/div&gt;
  
                  &lt;div id="mcont2-sub2" class="mcont-subs mcont-subs-2"&gt;
                      &lt;a href="game_details.html" &gt;&lt;img src="&lt;%=listGames[1].ImageURL;%&gt;" /&gt;&lt;/a&gt;
                      &lt;div class="descrip-place" id="Div1"&gt;
                          &lt;p class="description"&gt;Waiohai Beach Club Marriott&lt;/p&gt;
                          &lt;p class="place"&gt;Hawaii&lt;/p&gt;
                      &lt;/div&gt;
                      &lt;a  href="game_details.html" class="arrow-light-blue" &gt;&lt;img src="Images/arrow-light-blue.png" /&gt;&lt;/a&gt;
                  &lt;/div&gt;
  </code></pre>