AllowNullAttribute Class

Allows null as the argument of a mandatory cmdlet or function parameter.


Namespace: System.Management.Automation
Assembly: System.Management.Automation (in System.Management.Automation.dll)

'Usage
Dim instance As AllowNullAttribute

'Declaration
<AttributeUsageAttribute(AttributeTargets.Property Or AttributeTargets.Field)> _
Public NotInheritable Class AllowNullAttribute
	Inherits CmdletMetadataAttribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field) */ 
public final class AllowNullAttribute extends CmdletMetadataAttribute
AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field) 
public final class AllowNullAttribute extends CmdletMetadataAttribute

When this attribute is used null is converted to the parameter type. This means that adding AllowNull to the following parameter types is not useful.

  • String parameters should not use this attribute because null is converted to the empty string.

  • Value type parameters should not use this attribute because null is converted to 0 for numeric types, and null cannot be converted to most other value types.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

 

Target Platforms

Windows Developer Preview, Windows Server Developer Preview

Send comments about this topic to Microsoft.
Show:
© 2014 Microsoft