title: Show position of item in a list
body: <p>I am working with a link list. My constructor takes arrays with items in it or appends an item(one at time) to the list through <code>BtnAddTree</code> click. For experimental reasons I am trying to figure out a way to retrieve the position of an item from the list. I have set three buttons that will hopefully show: <code>first</code>, <code>next</code>, <code>last</code> item and display through a <code>label</code>. I created two functions to achieve my need <code>Retrieve</code> and <code>Current_Tree()</code> but here is where I come to a dead end. I am aware to display items that are <code>next</code> I may need to use a loop but unsure how to go about it. How can I display the position of an item found in the list?</p>
  
  <pre><code>        public class ListForTrees
          {
  
          //Retrieve Position of item
              public void Retrieve(int Position)
              {
                  int new_position = Position;
                  fruit_trees current = first_tree;
  
                  for (int i = 0; i &lt; Position &amp;&amp; current != null; i++)
                  {
                      current = current.next_tree;
                  }
                  return current;
              }
  
          //Show Current Tree
              public void Current_Tree()
              {
                  try
                  {
                      current = fruit_trees.first_tree;
                      labelSpecificTree.Text = current.Type.ToString();
                  }
                  catch { };
  
              }         
  
  
  
          }
  
          ListForTrees mainlist = new ListForTrees();     
  
          private void BtnGo_Click(object sender, EventArgs e)
          {
              fruit_trees[] ax = {   new fruit_trees("cherry", 48, 12.95, 3),
                                               new fruit_trees("pine", 36, 9.95, 8),
                                               new fruit_trees("oak", 60, 14.95, 2),
                                               new fruit_trees("peach", 54, 19.95, 3),
                                               new fruit_trees("pear", 36, 11.85, 2),
                                               new fruit_trees("apple", 62, 13.45, 5)
                                           };   
              mainlist = new ListForTrees(ax);
              fruit_trees current = mainlist.first_tree;   
  
              while (current != null)
              {
                  TxtOutput.AppendText(current.ToString() + Environment.NewLine);
                  current = current.next_tree;
              }
          }
  
          private void ShowNextItem_Click(object sender, EventArgs e)
          {
          //Show Next Item
          }
  
          private void ShowLastItem_Click(object sender, EventArgs e)
          {
          //Show Last Item
          }
  
          private void ShowFirstItem_Click_1(object sender, EventArgs e)
          {
          // Show First Item
          }
  
  
      }
  }
  </code></pre>