The tiny VB.NET quiz – byref or what the...?
Alright, here is the next quiz. Imagine the following code:
Module Module1 Dim intVal As Integer = 10 Dim dblVal As Double = 20 Sub Main() ModifyValue(intVal) ModifyValue(dblVal) PrintValues() End Sub Private Sub PrintValues() Console.WriteLine("{0} - {1}", intVal, dblVal) End Sub Private Sub ModifyValue(ByRef Value As Integer) Value = 30 PrintValues() End SubEnd Module |
This code will print out the following:
30 - 2030 - 2030 - 30 |
So why's that? Give it your best shot!
Daniel