Arne,
The "reference" to the data set, will be returned "by value". In other words
a copy of the reference to a single object on the heap will be returned.
DataSet is a Reference Type so variables of type DataSet always hold a
reference to the actual DataSet object. A single copy of the actual DataSet
object exists on the heap.
Where as Integer is a Value Type, so variables of type Integer always hold
the value of the actual Integer 'value'. Multiple copies of the Integer
value exists in each variable (either on the stack or in a Reference Type on
the heap).
Remember ByVal & ByRef are how parameters are passed, Reference Type & Value
Type are how variables are stored. If you pass a Reference Type ByVal a copy
of the reference to a single object on the heap is passed. If you pass a
Value Type ByVal a copy of the 'value' is passed. If you pass a Reference
Type ByRef, then a reference to the original variable is passed, the
original variable still contains a single reference to the object on the
heap. Likewise if you pass a Value Type ByRef, then a reference to the
original variable is passed.
Which allows the called routine of ByRef parameters to modify the what the
original variable contains/references...
Hope this helps
Jay
| Will the dataset below be returned by value or reference?
| Public Shared Function getDS() As DataSet
| Dim ds As New DataSet
| '... do something
| Return ds
| End Function