namespace System.Diagnostics.CodeAnalysis { /// Specifies that an output will not be null even if the corresponding type allows it. Specifies that an input argument was not null when the call returns. [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)] public sealed class NotNullAttribute : Attribute { } /// Specifies that when a method returns , the parameter may be null even if the corresponding type disallows it. [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] public sealed class MaybeNullWhenAttribute : Attribute { /// Initializes the attribute with the specified return value condition. /// /// The return value condition. If the method returns this value, the associated parameter may be null. /// public MaybeNullWhenAttribute(bool returnValue) => ReturnValue = returnValue; /// Gets the return value condition. public bool ReturnValue { get; } } // NOTE: you can find the full list of attributes in this gist: // https://gist.github.com/Sergio0694/eb988b243dd4a720a66fe369b63e5b08. // Keeping this one shorter so that the Medium embed doesn't take up too much space. }