Page 1 of 1

[PSS2016]Primal Sense for $PSBoundParameters.ContainsKey

Posted: Thu Nov 10, 2016 7:44 am
by Bosparan

a few months ago, I noticed a breaking change in how Enumerations were evaluated within boolean expressions. Which lead me from switching one of my most ancients behaviors: How to check whether a parameter was bound:


Code: Select all

if ($PSBoundParameters["BackgroundColor"])
# ...
... to ...


Code: Select all

if ($PSBoundParameters.ContainsKey("BackgroundColor"))
# ...
As it happens, this is actually the definitive way to determine, whether a parameter was bound - the previous way was unreliable to begin with.

Soooo ... I know you implemented Primal Sense for the previous method at my request back then (many thanks, it has served me well), would you mind also adding Primal Sense for the precise method of determining whether a parameter was bound?