Home > Blockchain >  What is this type of C# coding syntax called and what is it doing?
What is this type of C# coding syntax called and what is it doing?

Time:11-08

For the below code, specifically the {} that don't seem connected to anything, what is the syntax called and what is it doing?

And when/why can I omit the () when using this syntax?

var a = new OpenApiSecurityRequirement() // Can I omit () and when/why?
{
    { // What is this doing?
        new OpenApiSecurityScheme
        {
            Reference = new OpenApiReference
            {
                Type = ReferenceType.SecurityScheme,
                Id="Bearer"
            }
        },
        new string[]{}
    } // What is this doing?
};

CodePudding user response:

The outermost curly bracket is just a enter image description here

  • Related