I have read the following article about nullable reference analysis in C# 8 not long ago: https://www.meziantou.net/csharp-8-nullable-reference-types.htm
The post-condition attributes are particularly interesting to me. Recently I have encountered a situation where it might be useful to apply MemberNotNull
attribute. However, unexpectedly I can't find MemberNotNull
and MemberNotNullWhen
public attributes in the .Net core 3.1. However, I can see a number of internal attributes declared in .net core:
https://source.dot.net/#q=MemberNotNull
Are there any substitutions in .net core for these attributes. Do I have to use .net 5 to use them?
You can reference Nullable package. It will do basically the same as you did with copy-paste. Think that's the best way to backport these attributes to pre .net50 sdks.