.NET namespace names are too long to type and read - by mnvm

Status : 

 


3
0
Sign in
to vote
ID 844105 Comments
Status Active Workarounds
Type Suggestion Repros 0
Opened 3/31/2014 7:00:48 AM
Access Restriction Public

Description

The long namespace names of the .NET framework require a C#-like "using" directive supported by the language. Powershell is really missing such a directive. Workarounds found on the web are missing auto-complete support which is available only if the namespace is fully specified.


A common example:

$a = [System.Windows.Forms.MessageBox]::Show("Message", "Title", [System.Windows.Forms.MessageBoxButtons]::YesNo, System.Windows.Forms.MessageBoxIcon]::Question, [System.Windows.Forms.MessageBoxDefaultButton]::Button2)

if ($a -eq [System.Windows.Forms.DialogResult]::Yes)
{
}


Compare with:

using System.Windows.Forms

$a = [MessageBox]::Show("Message", "Title", [MessageBoxButtons]::YesNo, [MessageBoxIcon]::Question, [MessageBoxDefaultButton]::Button2)

if ($a -eq [DialogResult]::Yes)
{
}
Sign in to post a comment.