VB.NET, Is Object Returned by Reference from Function

后端 未结 3 1626
日久生厌
日久生厌 2021-01-05 17:31

This should be a fairly common question, but I haven\'t found a straightforward answer anywhere.

If I instantiate an object within a function in VB.NET and return it

3条回答
  •  醉酒成梦
    2021-01-05 18:17

    It just passes back a reference (assuming big_obj is a class). I wouldn't use the term "by reference" here, as that has a subtly different meaning when it comes to parameter passing - but assuming big_obj is a class - a reference type - the value of ret_obj is a reference, and that reference will be what's returned.

    I don't have any articles on this from a VB perspective, but if you're happy to look at C#, you may find these articles useful:

    • Reference and value types
    • Parameter passing in C#

提交回复
热议问题