Coding Quiz: Anonymous Type Types


Question: How can you create a variable in VB which is typed as an anonymous type but not actually create an instance of that type?

Answer in comments. 

Note, doing this is not particularly useful it came about while I was playing around with a feature a few days ago.

Comments (3)

  1. Module Module1

       Function GetAtType(Of T)(ByVal f As Func(Of T)) As T

           Return Nothing

       End Function

       Sub Main()

           Dim x = GetAtType(Function() New With {.Name = "Name"})

       End Sub

    End Module

  2. This discussion is building upon a previous post on how to acquire an anonymous type … type . 

  3. This discussion is building upon a previous post on how to acquire an anonymous type … type . The next