Classes/PowerShellTip.ps1
# Use C# classes and enums as they provide a better dev and module consumer experience: # https://blog.danskingdom.com/How-and-where-to-properly-define-classes-and-enums-in-your-PowerShell-modules/ # Store the actual code in a .cs file to get syntax checking and IntelliSense, and just read it in and load it here. # Only add the types if they don't already exist. This is quicker than re-adding the types and it failing. if (-not ('tiPS.PowerShellTip' -as [type])) { [string] $classDefinition = Get-Content -Path "$PSScriptRoot\PowerShellTip.cs" -Raw Add-Type -Language CSharp -TypeDefinition $classDefinition } |