Replies: 1 comment 1 reply
-
One concern I have is nullability attributes on lambdas: // Local functions
using System.Diagnostics.CodeAnalysis;
[return: NotNullIfNotNull("s")] string? m(string? s) => s;
string notNull = m(""); // no warning
string maybeNull = m(null); // warning // Explicitly typed delegates
using System.Diagnostics.CodeAnalysis;
// Type parameters can not have attributes such as NotNullIfNotNull
Func<string?, string?> f = [return: NotNullIfNotNull("s")] string? (string? s) => s;
string notNull = f(""); // warning (not desirable?) // Direct invocation of lambdas
using System.Diagnostics.CodeAnalysis;
string notNull = ([return: NotNullIfNotNull("s")] string? (string? s) => s)(""); // shouldn't warn? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
https://github.com/dotnet/csharplang/blob/main/meetings/2021/LDM-2021-07-26.md
Agenda
Beta Was this translation helpful? Give feedback.
All reactions