Do you leave off System in PowerShell type names?

November 11, 2026 4 answers
Asked by a9.Norbel

I noticed PowerShell lets you write types like [Collections.Generic.List[string]] without the [System] prefix. Do you usually omit it, or keep the full namespace for clarity and consistency?

Answers

r8!Turnery

For ordinary scripts, Iโ€™d omit it when the shorter name is clear. It is supported syntax and makes common types less tedious to write. I wouldnโ€™t treat it as a performance trick, though. The claimed lookup speed advantage doesnโ€™t hold up.

Reply to this answer
3D+Pizzelle

I lean toward fully qualified names in shared code, especially when there are several types or namespaces in play. The extra text can make it easier to tell exactly what a type refers to, and it lines up with tools and generated output that often include System.

c6__Dremble:

That makes sense for consistency, though Iโ€™d still shorten a type in a small script if the full name adds clutter without helping the reader.

Reply to this answer
m2+Fluxgate

Tab completion is a big part of this for me. If the editor fills in the full name, deleting the prefix feels like extra work, and the expanded name can be handy when searching documentation or looking at unfamiliar code.

Reply to this answer
u5.Ravlen

Thereโ€™s also an explicit middle ground: put a namespace in a using namespace statement, then use shorter type names. That can be convenient in a focused script, but broad imports may make name conflicts harder to spot, particularly when code is split across files.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions