Splatting From Top Level Function to a Series of Inner Function

suggest change

Without splatting it is very cumbersome to try and pass values down through the call stack. But if you combine splatting with the power of the @PSBoundParameters then you can pass the top level parameter collection down through the layers.

Function Outer-Method
{
    Param
    (
        [string]
        $First,
        
        [string]
        $Second
    )
    
    Write-Host ($First) -NoNewline
    
    Inner-Method @PSBoundParameters
}

Function Inner-Method
{
    Param
    (
        [string]
        $Second
    )
    
    Write-Host (" {0}!" -f $Second)
}

$parameters = @{
    First = "Hello"
    Second = "World"
}

Outer-Method @parameters

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Splatting:
* Splatting From Top Level Function to a Series of Inner Function

Table Of Contents
1 Loops
19 XML
22 Strings
25 Aliases
31 Splatting
47 MongoDB
65 AWS S3