skip to Main Content
Initialize New Anonymous Type On VB.NET

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.

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:

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

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

Back To Top
Close search
Search