title: Does it matter if the object of List(T) is being passed ByVal or ByRef
body: <p>In the following example, does it matter if i pass the List(T) object in both functions ByRef or ByVal? </p>
  
  <p>Is this right that as List is a reference type so value will always be changes even if i pass the object ByVal. </p>
  
  <p>Would it be better if i pass the object byRef in function "ListChanged" as list is being updated.</p>
  
  <pre><code>Public Class MyClass_
  
      Public Sub TestMethod()
  
          Dim List_1 As New List(Of Integer)()
          Dim List_2 As New List(Of Integer)()
  
          List_1.Add(100)
          List_2.Add(50)
  
          List_1 = ActualListNotChanged(List_1)  '---101
          List_2 = ListChanged(List_2)        '---50,51
  
      End Sub
  
  
      Private Function ActualListNotChanged(ByVal lst As List(Of Integer)) As List(Of Integer)
  
          Dim nList As New List(Of Integer)()
  
          For Each item As Integer In lst
              If item &lt;&gt; 50 Then
                  nList.Add(101)
              End If
          Next item
  
          Return nList
  
      End Function
  
      Private Function ListChanged(ByVal lst As List(Of Integer)) As List(Of Integer)
  
          lst.Add(51)
          Return lst
  
      End Function
  
  End Class
  </code></pre>