title: Get first element of LinkedList<T>
body: <p>I'm a beginner programmer and I have this problem in C#. The solution is probably easy, but that's not for me to decide. </p>
  
  <p>I have this custom class that inherits LinkedList and I need a method to return first element and remove it from list.
  Code:</p>
  
  <pre><code>class CustomClass : LinkedList&lt;CustomElement&gt;
  {
      public CustomElement getFirstElement(){
          //here is the problem and I don't know how to solve it
          CustomElement ce = this.First;
          this.RemoveFirst();
          return first;
      }
  }
  </code></pre>
  
  <p>Problem is that <code>this.First</code> returns LinkedListNode. I tried this:</p>
  
  <pre><code>LinkedListNode&lt;CustomElement&gt; first = this.First;
  </code></pre>
  
  <p>But then the return statement fails, because type of method is <code>CustomElement</code>.</p>