ByVal vs ByRef

Value type

ByVal creates a copy of the object, ByRef only copies the pointer.

Reference type

Neither ByVal nor ByRef make a copy of the object. When passing a reference type ByVal, only a copy of the pointer is created, not the whole object. Modifications to an object passed ByVal will also be made to the original object. Passing a reference object ByRef doesn’t even copy the pointer, as such the original object will be modified if the variable passed is assigned a new object.