Condividi tramite


ArgumentTransformationAttribute Class

Definition

Serves as the base class for attributes that perform argument transformation.

public ref class ArgumentTransformationAttribute abstract : System::Management::Automation::Internal::CmdletMetadataAttribute
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property)]
public abstract class ArgumentTransformationAttribute : System.Management.Automation.Internal.CmdletMetadataAttribute
[<System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property)>]
type ArgumentTransformationAttribute = class
    inherit CmdletMetadataAttribute
Public MustInherit Class ArgumentTransformationAttribute
Inherits CmdletMetadataAttribute
Inheritance
ArgumentTransformationAttribute
Derived
Attributes

Remarks

Argument transformation attributes can be attached to Cmdlet and CmdletProvider parameters to automatically transform the argument value in some fashion. The transformation might change the object, convert the type, or even load a file or AD object based on the name. Existing argument transformation attributes include System.Management.Automation.ArgumentTypeConverterAttribute. Custom argument transformation attributes should derive from ArgumentTransformationAttribute and override the Transform(EngineIntrinsics, Object) abstract method, after which they can apply the attribute to their parameters. It is also recommended to override ToString() to return a readable string similar to the attribute declaration, for example "[ValidateRangeAttribute(5,10)]". If multiple transformations are defined on a parameter, they will be invoked in series, each getting the output of the previous transformation.

Constructors

ArgumentTransformationAttribute()

Initializes a new instance of the ArgumentTransformationAttribute class.

Properties

TransformNullOptionalParameters

The property is only checked when: a) The parameter is not mandatory b) The argument is null.

Methods

Transform(EngineIntrinsics, Object)

Method that will be overridden by the subclasses to transform the inputData parameter argument into some other object that will be used for the parameter's value.

Applies to

See also

  • <xref:System.Management.Automation.ArgumentTypeConverterAttribute>