Argument-transformation attributes may be added to parameters used in scripts and functions. An argument-transformation attribute is used to convert the value of an argument for a parameter. The transformation operation is carried out before PowerShell completes the assignment to the variable, side-stepping type mismatch errors.
A class must be created that inherits from System.Management.Automation.ArgumentTransformationAttribute. The class must implement a Transform method.
The Transform method must accept two arguments with the System.Object and System.Management.Automation.EngineIntrinsics types. The argument names are arbitrary, the names used in the following example follow the naming used in the .NET reference: https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.argumenttransformationattribute.transform?view...