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:

Dim url = "http://www.some-api.com".AppendPathSegment("endpoint").SetQueryParams(New With {
	.api_key = ConfigurationManager.AppSettings("SomeApiKey"),
	.max_results = 20,
	.q = "Don't worry, I'll get encoded!"
})

Below is the equivalent counterpart of the code above in C# for reference:

var url = "http://www.some-api.com"
	.AppendPathSegment("endpoint")
	.SetQueryParams(new {
	  api_key = ConfigurationManager.AppSettings["SomeApiKey"],
	  max_results = 20,
	  q = "Don't worry, I'll get encoded!"
});

You can read more about anonymous type on VB.NET from the MSDN page here.