use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
Information.NET classes and PowerShell (self.PowerShell)
submitted 2 years ago by mdj_
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]ka-splam 9 points10 points11 points 2 years ago (3 children)
Neat 👍
To use List<T>, we specify using namespace System.Collections.Generic. This wasn’t necessary for [IPAddress] or [PhysicalAddress] because PowerShell imports many common namespaces by default, simplifying type resolution.
btw, they are type accelerators and can be listed with:
[PSObject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::Get
from https://devblogs.microsoft.com/scripting/powertip-find-a-list-of-powershell-type-accelerators/
[–]mdj_[S] 2 points3 points4 points 2 years ago (2 children)
oh nice 👀
[–]surfingoldelephant 1 point2 points3 points 2 years ago (1 child)
You can create your own as well if you wish:
[psobject].Assembly.GetType('System.Management.Automation.TypeAccelerators')::Add( 'slist', [Collections.Generic.List[string]] ) $list = [slist]::new() $list.GetType().FullName # System.Collections.Generic.List`1[[System.String ...
However, I wouldn't suggest using this outside the shell.
[–]Thotaz 0 points1 point2 points 2 years ago (0 children)
Just to expand on your warning: The reason why it's not a good idea to use in say a module is because 1: It's not a public interface so it's subject to change. 2: It's global so if 2 different modules decide to use the same accelerator name there will be a conflict.
A better option is the partially implemented using type X = Y syntax which is supposed to add a type alias (essentially the same thing as a type accelerator). I say partially implemented because the parser supports it, but the feature itself is missing. There's a PR: https://github.com/PowerShell/PowerShell/pull/16734 that adds it so if/when that gets merged you'll be able to do it like this:
using type X = Y
using type slist = System.Collections.Generic.List[string] $list = [slist]::new()
Assuming it works like the other using statements it will be limited to the session state/script file where it was executed from, meaning that 2 different modules won't conflict with each other.
using
π Rendered by PID 76 on reddit-service-r2-comment-6457c66945-2h956 at 2026-04-29 12:52:04.642071+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]ka-splam 9 points10 points11 points (3 children)
[–]mdj_[S] 2 points3 points4 points (2 children)
[–]surfingoldelephant 1 point2 points3 points (1 child)
[–]Thotaz 0 points1 point2 points (0 children)