Func(Of TResult)() is a special delegate named Func . This is a type declared inside the System namespace as follows:
Public Delegate Function Func(Of TResult)() As TResult
It could be called differently. For instance:
Public Delegate Function MyParameterLessFunction(Of TResult)() As TResult
So Func is just the name given to the delegate. Because type F2 not explicitly specified, VB does not know the name for this delegate. Is it Func or MyParameterLessFunction or something else? Instead, VB simply displays its signature Function() As String , since F2 also suitable for a non-universal delegate declared as
Public Delegate Function AnonymousParameterLessStringFunction() As String
In your comment, you use .ToString() on F and F2 . This returns runtime types, that is, the types of values assigned to these variables. These types may differ from the static types of these variables, i.e. The type to be assigned to the variable name. Let's do a little test
Imports System.Reflection Module FuncVsFunction Dim F As Func(Of String) = Function() As String Return "B" End Function Dim F2 = Function() As String Return "B" End Function Sub Test() Console.WriteLine($"Run-time type of F: {F.ToString()}") Console.WriteLine($"Run-time type of F2: {F2.ToString()}") Dim moduleType = GetType(FuncVsFunction) Dim fields As IEnumerable(Of FieldInfo) = moduleType _ .GetMembers(BindingFlags.NonPublic Or BindingFlags.Static) _ .OfType(Of FieldInfo) For Each member In fields Console.WriteLine($"Static type of {member.Name}: {member.FieldType.Name}") Next Console.ReadKey() End Sub End Module
Displays
Run-time type of F: System.Func'1[System.String] Run-time type of F2: VB$AnonymousDelegate_0'1[System.String] Static type of F: System.Func'1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] Static type of F2: System.Object
Note that F2 simply entered as an Object . It's a surprise. I expected this to be a delegate type.
You also see this difference in the debugger. If you set the Test point to the Test method and then hover over the keywords Dim F and F2 , a pop-up window will appear.
'Dim of F (static type) Delegate Function System.Func(Of Out TResult)() As String 'Dim of F2 (static type) Class System.Object
If you hover over variable names
'F (run-time type) Method = {System.String _Lambda$__0-0()} 'F2 (run-time type) <generated method>
For F you get not only type information, but also the name of the generated method itself. Since F2 is an object, Visual Studio obviously does not dig as deep as for F