IEnumerable<KeyValuePair<string, string?>> and IEnumerable<KeyValuePair<string, string>> #4894
Unanswered
TonyValenti
asked this question in
Q&A
Replies: 3 comments 4 replies
-
Currently there's no way. It's similar to the problem of |
Beta Was this translation helpful? Give feedback.
4 replies
-
"Task nullability covariance" #3950 is approved but needs design. I feel that the feature should be extended into a more generalized "nullable variance" feature. KeyValuePair is a particular pain point, and so are tuples and other kinds of generic containers. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Real world issue: using System.Collections.Generic;
using System.Net.Http;
#nullable enable
_ = new FormUrlEncodedContent(new Dictionary<string, string>()); // CS8620 in .NET 5 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How do I write a method that can accept an:
IEnumerable<KeyValuePair<string, string?>>
or an
IEnumerable<KeyValuePair<string, string>>
as a parameter value?
Because string is a class, they boil down to the same thing except I can't seem to make the nullable warnings go away.
Beta Was this translation helpful? Give feedback.
All reactions