Skip to content

Optional new() constraint #2483

Answered by jnm2
TonyValenti asked this question in Q&A
Discussion options

You must be logged in to vote

new TProvider() is syntax sugar for Activator.CreateInstance<TProvider>(). You can do the same with reflection to test whether a public parameterless constructor exists.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by YairHalberstadt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #2483 on October 26, 2020 12:52.