Share via


ImportAttribute.AllowDefault Property

Definition

Gets or sets a value that indicates whether the property or parameter will be set to its type's default value when an export with the contract name is not present in the container.

public bool AllowDefault { get; set; }

Property Value

true if the property or parameter will be set to its type's default value when there is no export with the contract name in the host container; otherwise, false. The default is false.

Applies to

Product Versions
.NET Core 1.1, 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)