MemberNotNullWhenAttribute Constructors

Definition

Overloads

MemberNotNullWhenAttribute(Boolean, String)

Initializes the attribute with the specified return value condition and a field or property member.

MemberNotNullWhenAttribute(Boolean, String[])

Initializes the attribute with the specified return value condition and list of field and property members.

MemberNotNullWhenAttribute(Boolean, String)

Source:
NullableAttributes.cs
Source:
NullableAttributes.cs
Source:
NullableAttributes.cs

Initializes the attribute with the specified return value condition and a field or property member.

C#
public MemberNotNullWhenAttribute(bool returnValue, string member);

Parameters

returnValue
Boolean

The return value condition. If the method returns this value, the associated parameter will not be null.

member
String

The field or property member that is promised to be non-null.

Applies to

.NET 10 and other versions
Product Versions
.NET 5, 6, 7, 8, 9, 10

MemberNotNullWhenAttribute(Boolean, String[])

Source:
NullableAttributes.cs
Source:
NullableAttributes.cs
Source:
NullableAttributes.cs

Initializes the attribute with the specified return value condition and list of field and property members.

C#
public MemberNotNullWhenAttribute(bool returnValue, params string[] members);

Parameters

returnValue
Boolean

The return value condition. If the method returns this value, the associated parameter will not be null.

members
String[]

The list of field and property members that are promised to be non-null.

Applies to

.NET 10 and other versions
Product Versions
.NET 5, 6, 7, 8, 9, 10