Skip to content
Discussion options

You must be logged in to vote
        static void DoSomethingOverload1<T>()
            where T : class, IDisposable, new()
        {
            // No error
            DoSomething(GetInstance<T>);
        }

Delegate variance requires a reference type. So you need class constraint.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by YairHalberstadt
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
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 #1573 on October 15, 2020 14:40.