This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. .\lib.common\MethodHelpers.ps1 | |
. .\lib.common\PowerObject.ps1 | |
function Get-Color{ | |
[cmdletBinding()] | |
Param () | |
DynamicParam { | |
[System.Drawing.Color]::FromName,[System.Drawing.Color]::FromKnownColor | Get-DynamicParamForMethod | |
} | |
process { | |
[System.Drawing.Color]::FromName,[System.Drawing.Color]::FromKnownColor | Invoke-MethodOverloadFromBoundParam -parameterSet $PSCmdlet.ParameterSetName -Parameters $PSBoundParameters | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Slightly changed the code to allow several method through the use of the pipeline.
I haven't tested loads of cases, and there's no collision detection between the method signature.
If 2 methods have same empty signature it's probably not going to work, or if a parameter has the same name but different type. Be warned :)
Do provide me with example if stuff do not work, and I might have a look.