Parameter Classes: Making parameter-binding user friendly
summary
Parameter Classes claim a reusable way to drive parameter binding: build a class (PowerShell or C#) with multiple constructors to parse strings, relative timestamps, file objects, or preserve the original inputObject, register extra type mappings via a static hashtable, and expose an implicit operator so the parameter behaves like the underlying type. The presenter shows a C# version runs ~2400 ticks vs PowerShell ~5700 ticks for 1,000 conversions, and reports this pattern scales to projects like dbatools (380+ commands); it works but has runspace, ambiguity and performance caveats.
AI-written summary · about
chapters (10)
- 0:00The problem with binding
- 2:57Methods for type conversion
- 5:40Implementing parameter classes
- 10:04Adding user convenience
- 14:04Retaining input metadata
- 17:30Extensibility through registry
- 21:10PowerShell vs C# performance
- 24:30Adding advanced metadata
- 28:14Implicit operators and scaling
- 35:37Real-world application
related talks
45mBullet-proofing Patterns & Practices
52mPowerShell Module Design Rules (and When to Bend Them)
45mPimp Your Parameters: The Magic of PowerShell Argument..
01h 16mLevel Up Your PowerShell: Essential Tips, Tricks, and Techniques
35mImproving Your Attributes
51mDon't do that, do this instead: PowerShell worst practices and..
01h 37mMore Game Breaking PowerShell
47mThe Human Side of PowerShell Scripting
