title: Deep copying of elements in a List (Of Class)
body: <p>Good evening. </p>
  
  <p>I'm trying to do a deep copy of some of the elements of a list, and I'm finding it extremely hard to do. There's a lot of new concepts I'm trying so bear with me if some of the following code seems weird...</p>
  
  <p>I have the following lists: </p>
  
  <pre><code>accountList as List(Of Account)
  accountsInArea as New List(Of Account)
  result as New List(Of Account)
  </code></pre>
  
  <p>Where each element's type is a Class defined by myself:</p>
  
  <pre><code>Public Class Account
  
  Enum AddingType
      income
      expenditure
  End Enum
  Enum AreaType
      high
      mid
      low
  End Enum
  
  Property Area() As AreaType
  Property Group() As String
  Property AccountNumber() As Integer
  Property AccountDescription() As String
  Property IncomeExpenditure() As AddingType
  Public Property MonthlyValues As New Dictionary(Of Integer, Decimal)
  End Class
  </code></pre>
  
  <p>I need to find <strong>certain</strong> items of <code>accountList</code> and copy <strong>the values</strong> to a new list: <code>accountsInArea</code>. For now, I have used the following method: </p>
  
  <pre><code>accountsInArea = accountList.FindAll(Function(acc) acc.Area = area)
  </code></pre>
  
  <p>However, this produces a copy of the <strong>reference</strong> to those items the Lambda Expression produces (doesn't it?). If I understood correctly while surfing around SO and MSDN, what I need is a <strong>deep copy</strong> of the elements. </p>
  
  <p>I'd like <code>accountsInArea</code> to have <strong>a copy</strong> of all the items <code>.FindAll</code> produced, including (especially) those in the <code>MonthlyValues</code>Dictionary. </p>
  
  <p>I have tried: </p>
  
  <pre><code>accountsInArea = accountList.Select(accountList.FindAll(Function(acc) acc.Area = area))
  </code></pre>
  
  <p>Also:</p>
  
  <pre><code>For Each account In accountList.FindAll(Function(acc) acc.Area = area)
      accountsInArea.Add(account)
  Next
  </code></pre>
  
  <p>And lastly adding to the Class: </p>
  
  <pre><code>Implements ICloneable
  
  Public Function Clone() As Object Implements System.ICloneable.Clone
      Return Me.MemberwiseClone
  End Function
  </code></pre>
  
  <p>And using inside the method: </p>
  
  <pre><code>accountsInArea = accountList.FindAll(Function(acc) acc.Area = area)
      result = accountsInArea.Select(Function(acc) acc.Clone()).Cast(Of Account).ToList
  </code></pre>
  
  <p>Help would be GREATLY appreciated. </p>