Reputation: 489
I have a Powershell script with 2 functions that are very similar in parameters. Is it possible to combine the parameters (Computername, Port, OtherVariable) into some sort of set?
In this example, it's only 3 parameters but in reality it's 11 parameters. I'm thinking of doing this because the parameterlist is starting to become a bit long.
function Function1
{
Param(
[Parameter()]
[String]$Filename,
[Parameter()]
[String]$Computername,
[Parameter()]
[String]$Port,
[Parameter()]
[String]$OtherVariable
)
Process
{
}
}
function Function2
{
Param(
[Parameter()]
[String]$Url,
[Parameter()]
[String]$Computername,
[Parameter()]
[String]$Port,
[Parameter()]
[String]$OtherVariable
)
Process
{
}
}
Upvotes: 0
Views: 78
Reputation: 3518
You have a few options:
*super being superset
Upvotes: 1