Assignment statements vs object initializers
Creating and assigning values to object instances is done through one of two syntaxes. The more traditional and clunkier syntax is the assignment statement. Assignment statements typically begin with an empty constructor, followed by multiple assignments, one for each variable to be set. Here is an example:
The newer syntax and much improved syntax is the object initializer. In a single statement, multiple variables are set at the same time the object is instantiated. The assignments are also tabbed, which allow for easier reading. Here is an example:
So when you need to search syntax on how to initialize something in one call, you can attach “object initializer” to your search. Example: “c# new dictionary object initializer”