This topic has not yet been rated - Rate this topic

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

[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field)] 
public sealed class AllowNullAttribute : 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.


System.Object
   System.Attribute
     System.Management.Automation.Internal.CmdletMetadataAttribute
       System.Management.Automation.AllowNullAttribute
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.
© 2013 Microsoft. All rights reserved.