Skip to content

Overloading methods that accepts delegates which differs in nullability #7525

Answered by TahirAhmadov
HazyFish asked this question in Q&A
Discussion options

You must be logged in to vote

@HazyFish yes you are right of course, with the main usage scenario being supplying a lambda/delegate, the custom delegate types don't work, either.

Looking at your snippet now, I tend to agree with @iam3yal that a different name is in order here, because the difference is so subtle that you want to make sure users know what they are calling - even if C# supported overloading on nullability (which it doesn't).

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@HazyFish
Comment options

@Richiban
Comment options

@TahirAhmadov
Comment options

Answer selected by HazyFish
@iam3yal
Comment options

Comment options

You must be logged in to vote
1 reply
@HazyFish
Comment options

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