Class MemberNotNullWhenAttribute
- Namespace
- System.Diagnostics.CodeAnalysis
- Assembly
- mscorlib.dll
Specifies that the method or property will ensure that the listed field and property members have not-null values when returning with the specified return value condition.
[AttributeUsage(AttributeTargets.Method|AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
public sealed class MemberNotNullWhenAttribute : Attribute
- Inheritance
-
MemberNotNullWhenAttribute
- Inherited Members
- Extension Methods
Constructors
MemberNotNullWhenAttribute(bool, string)
Initializes the attribute with the specified return value condition and a field or property member.
public MemberNotNullWhenAttribute(bool returnValue, string member)
Parameters
returnValueboolThe return value condition. If the method returns this value, the associated parameter will not be null.
memberstringThe field or property member that is promised to be not-null.
MemberNotNullWhenAttribute(bool, params string[])
Initializes the attribute with the specified return value condition and list of field and property members.
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
Parameters
returnValueboolThe return value condition. If the method returns this value, the associated parameter will not be null.
membersstring[]The list of field and property members that are promised to be not-null.
Properties
Members
Gets field or property member names.
public string[] Members { get; }
Property Value
- string[]
ReturnValue
Gets the return value condition.
public bool ReturnValue { get; }