Description
Normally, the API documentation is straightforward about the different overloads in a method, and whether they augment more minimalist overloads, or are used to cover different purposes
For the life of me, I can't figure out when I would use ShouldProcess(String, String, String, ShouldProcessReason) or ShouldProcess(String, String, String) or why, instead of the other two. The examples not being in formatted code blocks isn't really helping either.
Both of those methods say This variant allows the caller to specify the complete text describing the operation, rather than just the name and action.
I assume the 'caption' parameter is supposed to allow a more freeform text over the canned text when only providing the 'target' or both 'target' and 'action'. But why would I use 'caption' when it says may be displayed by some hosts, but not all
, and the overloads with only 'action'/'target' parameters don't document such a limitation?
Additionally, as this document is related to PowerShell, I don't understand why 'ShouldProcessReason' would ever be needed. ShouldProcess would only be used if CmdletBinding()
is called with SupportsShouldProcess=$True
, which then exposes the -WhatIf parameter. What use case is there to then specify 'ShouldProcessReason'?