You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"A constructor that takes no parameters is called a default constructor." #10517
A constructor that takes no parameters is called a default constructor.
That's incorrect (and the page misuses this term throughout). It's called a parameterless (or no-parameters, or zero-parameters) constructor. As it says in the specification (§15.11.5), a default constructor is the constructor the C# compiler provides for you if you don't specify any constructors in your code. The default constructor is a parameterless constructor, but not all parameterless constructors are default constructors. If the constructor is explicitly written in the class, by definition it's not a default constructor.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
ID: 374a58d4-1905-c664-04b6-fd68e617f8c9
Version Independent ID: 36d0bf3a-29bf-5162-c700-142b03f9a16c
I'm getting (an issue?) that unless I provide a parameterless constructor then I can't declare a constructor with a parameter, at least, it'll give an error when run of no matching property. I.e. if you want to use a constructor with a parameter then you must also declare a parameterless constructor.
Activity
ASKemp commentedon Feb 18, 2019
I'm getting (an issue?) that unless I provide a parameterless constructor then I can't declare a constructor with a parameter, at least, it'll give an error when run of no matching property. I.e. if you want to use a constructor with a parameter then you must also declare a parameterless constructor.
BillWagner commentedon Feb 25, 2019
Thanks for raising this issue. You are correct @tjcrowder
@ASKemp For your issue, I'd need to see a small sample to understand what's the core reason.
Replace "default ctor" with "parameterless ctor"
Replace "default ctor" with "parameterless ctor" (#11945)