To use a .net type, I normally do Add-Type
then use New-Object
:
Add-Type -AssemblyName "System.Windows.Forms"
$win = New-Object Windows.Forms.Form
But really I can also just use square bracket syntax to refer the type and use static methods:
$win = [System.Windows.Forms.Form]::new()
What's the difference between them? I have not found much documentation with square bracket syntax for .Net types. All documentation I found for square brackets are for the arrays.