NullabilityInfoContext.Create Method

Definition

Overloads

Create(EventInfo)

Populates a NullabilityInfo for the given EventInfo. If the nullablePublicOnly feature is set for an assembly, like it does in the .NET SDK, the private and/or internal member's nullability attributes are omitted, and the API will return the Unknown state.

Create(FieldInfo)

Populates a NullabilityInfo for the given FieldInfo. If the nullablePublicOnly feature is set for an assembly, like it does in the .NET SDK, the private and/or internal member's nullability attributes are omitted, and the API will return the Unknown state.

Create(ParameterInfo)

Populates a NullabilityInfo for the given ParameterInfo. If the nullablePublicOnly feature is set for an assembly, like it does in the .NET SDK, the private and/or internal member's nullability attributes are omitted, and the API will return the Unknown state.

Create(PropertyInfo)

Populates a NullabilityInfo for the given PropertyInfo. If the nullablePublicOnly feature is set for an assembly, like it does in the .NET SDK, the private and/or internal member's nullability attributes are omitted, and the API will return the Unknown state.

Create(EventInfo)

Source:
NullabilityInfoContext.cs
Source:
NullabilityInfoContext.cs
Source:
NullabilityInfoContext.cs

Populates a NullabilityInfo for the given EventInfo. If the nullablePublicOnly feature is set for an assembly, like it does in the .NET SDK, the private and/or internal member's nullability attributes are omitted, and the API will return the Unknown state.

C#
public System.Reflection.NullabilityInfo Create(System.Reflection.EventInfo eventInfo);

Parameters

eventInfo
EventInfo

The event for which to populate nullability information.

Returns

A NullabilityInfo instance.

Exceptions

eventInfo is null.

Applies to

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

Create(FieldInfo)

Source:
NullabilityInfoContext.cs
Source:
NullabilityInfoContext.cs
Source:
NullabilityInfoContext.cs

Populates a NullabilityInfo for the given FieldInfo. If the nullablePublicOnly feature is set for an assembly, like it does in the .NET SDK, the private and/or internal member's nullability attributes are omitted, and the API will return the Unknown state.

C#
public System.Reflection.NullabilityInfo Create(System.Reflection.FieldInfo fieldInfo);

Parameters

fieldInfo
FieldInfo

The field for which to populate the nullability information.

Returns

A NullabilityInfo instance.

Exceptions

fieldInfo is null.

Applies to

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

Create(ParameterInfo)

Source:
NullabilityInfoContext.cs
Source:
NullabilityInfoContext.cs
Source:
NullabilityInfoContext.cs

Populates a NullabilityInfo for the given ParameterInfo. If the nullablePublicOnly feature is set for an assembly, like it does in the .NET SDK, the private and/or internal member's nullability attributes are omitted, and the API will return the Unknown state.

C#
public System.Reflection.NullabilityInfo Create(System.Reflection.ParameterInfo parameterInfo);

Parameters

parameterInfo
ParameterInfo

The parameter for which to populate the nullability information.

Returns

A NullabilityInfo instance.

Exceptions

parameterInfo is null.

Applies to

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

Create(PropertyInfo)

Source:
NullabilityInfoContext.cs
Source:
NullabilityInfoContext.cs
Source:
NullabilityInfoContext.cs

Populates a NullabilityInfo for the given PropertyInfo. If the nullablePublicOnly feature is set for an assembly, like it does in the .NET SDK, the private and/or internal member's nullability attributes are omitted, and the API will return the Unknown state.

C#
public System.Reflection.NullabilityInfo Create(System.Reflection.PropertyInfo propertyInfo);

Parameters

propertyInfo
PropertyInfo

The property for which to populate the nullability information.

Returns

A NullabilityInfo instance.

Exceptions

propertyInfo is null.

Applies to

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