ArgumentTransformationAttribute Class

Serves as a base class for attributes that perform argument transformations.


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

'Usage
Dim instance As ArgumentTransformationAttribute

[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field)] 
public abstract class ArgumentTransformationAttribute : CmdletMetadataAttribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field) */ 
public abstract class ArgumentTransformationAttribute extends CmdletMetadataAttribute
AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field) 
public abstract class ArgumentTransformationAttribute extends CmdletMetadataAttribute

Argument transformation attributes can be attached to Cmdlet and CmdletProvider class parameters to automatically transform the argument value in some way. The transformation might change the object, convert the type, or even load a file or Active Directory object, based on its name.

Snap-ins that implement custom argument transformation attributes should derive from the ArgumentTransformationAttribute class and override the Transform abstract method, after which they can apply the attribute to their parameters.

It is also recommended to override the ToString method to return a readable string that is similar to the attribute declaration. For example, for the ValidateRangeAttribute attribute, the string [ValidateRangeAttribute(5,10)] could be returned.

If multiple transformations are defined on a parameter, they will be invoked in a series, each getting the output of the previous transformation.


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


Show:
© 2014 Microsoft