I’m not sure how else to put this, or I’m overthinking my problem.
I have a function (lets call him Get-Stuff).
Get-Stuff has four params listed. All of his params from the commands he’s populating are optional (Get-MessageTrackingLog).
However, I don’t need all 4 parameters sometimes when I call Get-Stuff sometimes. Sometimes I need 2 or 1 or 3.
What kind of logic am I’m attempting to implement to handle this dynamic request? Do I test if the input variable has a length greater then 0 and then make a separate line to handle that? Do I do that foreach one? If I do that means I have to account for all combinations of those 4 params. What should I be doing? I’m a bit stuck here and looking for a pointer as to where to go.
So, what I’m asking is that should this command work even if all of the listed params are NOT populated?
Get-Stuff -Param1 -Param2 -Param3 -Param4
I’m allowing empty strings on each FWIW.
submitted by /u/RC-7201
[link] [comments]
The post Function to accept some, but not all, input provided by user. appeared first on How to Code .NET.