Replies: 1 comment 7 replies
-
This is incorrect. Parameterless constructor is not involved in array creation of C#. Console.WriteLine((new S[1])[0].a);
struct S
{
public int a;
public S()
{
a = 1;
}
} prints 0. I'm not recommending the usage of term "implicit parameterless ctor". It's actually the alias of |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've recently stumbled upon the following compiler behavior and I wonder if this was intentionally done this way (for whatever reason) or it's a bug (and in such case where to report it so that it won't be ping-ponged between repos):
Beta Was this translation helpful? Give feedback.
All reactions