Is any code inside the constructor executed when I declare a struct instance?

Viewed 57
struct  bb
{
    public int j = 8;
    public int f;

    public bb()
    {
        f = 88;
    }
}

//main method
bb test;

I know that when I declare test the parameterless constructor is called but I am guessing that it is only called to initialize the fields to their defaults and create the object but any other code is not run like f=88; inside the constructor.

Am I correct?

This pertains to C# 11.

0 Answers
Related