Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConstructorInfo ought to have a CreateDelegate method, just as MethodInfo has. #355

Closed
vsfeedback opened this issue Nov 27, 2019 · 1 comment

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


Given ConstructorInfo has an Invoke method, why not have a CreateDelegate method, so I can invoke it in a type-safe manner, without boxing and object[] allocation?


Original Comments

Fiona Niu[MSFT] on 10/28/2018, 11:03 PM:

Thank you for taking the time to provide your suggestion. We will do some preliminary checks to make sure we can proceed further. You will hear from us in about a week on our next steps.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Nov 27, 2019
@GrabYourPitchforks GrabYourPitchforks removed the untriaged New issue has not been triaged by the area owner label Mar 12, 2020
@GrabYourPitchforks
Copy link
Member

A constructor on a type is really a void-returning instance method, but presumably if you want to wrap a constructor within a delegate you actually wanted to instantiate the object, returning the new object instance. This isn't something that can be accomplished with a single method invocation. See #32520 for an alternative proposal which attempts to provide a usable API for this scenario.

See also: #23716, #31895

@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants