title: vb.net Passing a list through a function without list value changed
body: <p>The list value changeed here when passed ByVal why
  ,it must be not changed.</p>
  
  <pre><code>Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
          Dim value As Integer = 1
          Dim value2 As New List(Of Decimal)
          value2.Add(1)
          value2.Add(2)
  
          ' The integer value doesn't change here when passed ByVal.
          Example1(value)
          Console.WriteLine(value)
  
          ' The list value changeed here when passed ByVal.
          Example3(value2)
          Console.WriteLine(value)
  </code></pre>
  
  <p>End Sub</p>
  
  <pre><code>    Sub Example1(ByVal test As Integer)
          test = 10
      End Sub
  
      Sub Example3(ByVal test As List(Of Decimal))
          test.Add(3)
      End Sub
  </code></pre>
  
  <p>its solved ,the solution is making new copy:</p>
  
  <pre><code>Sub Example3(ByVal test As List(Of Decimal))
          Dim testnew As New List(Of Decimal)
          testnew.AddRange(test)
          testnew.Add(3)
      End Sub
  </code></pre>