Freigeben über


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

  • Anonymous
    August 01, 2007
    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

  • Anonymous
    October 01, 2007
    This discussion is building upon a previous post on how to acquire an anonymous type ... type . 

  • Anonymous
    October 01, 2007
    This discussion is building upon a previous post on how to acquire an anonymous type ... type . The next