Initialize New Anonymous Type on VB.NET
This code snippet will shows you an example on how to initialize a new anonymous type and define the properties while at it as a function parameter in Visual Basic .NET. The example used is based on Flurl library by tmenier, and URL builder for .NET check it out at the Project’s GitHub Page, it’s pretty neat. Dim url = "http://www.some-api.com".AppendPathSegment("endpoint").SetQueryParams(New With { Key .api_key = ConfigurationManager.AppSettings("SomeApiKey"), Key .max_results = 20, Key .q = "Don't worry, I'll get encoded!" }) Alternatively you can omit the Key keyword if you are not planning to compare the Anonymous type for equality and planning to change the value of the property, like so: ...