Just to learn more about this situation I would like to know how to handle
the following to return the 'actual' default for the generic type used.
When I am using Guid as the generic value like the following:
GetMessageHeader(Of Guid)(message,name,ns) it currently returns nothing if
the else statement is reached? Wouldn't the default of a guid be a guid type
containing all zeros?
Here is the converted code in question:
Public Shared Function GetMessageHeader(Of T)(ByVal message As Message,
ByVal name As String, ByVal ns As String) As T
Dim index As Integer = message.Headers.FindHeader(name, ns)
If (index > -1) Then
Dim val As T = message.Headers.GetHeader(Of T)(name, ns)
Return val
Else
'The following is what this question is all about
'C# = default(T)
Return Nothing
End If
End Function
Thanks