I am not a VB.NET expert, but I know something about C #. In C #, this type of code is not valid. You should always return value, otherwise the code will not compile.
I assume VB.NET bypasses this in C #:
T Sum = default(T); ... return Sum;
The default value is Sum , which in the case of int is 0 .
In accordance with this logic, the variable gets highlighted for reference types, which means that there will be no allocation, since by default they are null .
Looking at IL:
.method public static int32 Test() cil managed {
from this Function :
Function Test() As Integer End Function
You will see init , which initializes the variable (allocates it) and ldloc , which is a call to get the value of the variable, so it should be highlighted.
source share