Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6695999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:17:21+00:00 2026-05-26T06:17:21+00:00

PowerShell 3.0 CTP1 introduces a new feature [ordered] which is somewhat a shortcut for

  • 0

PowerShell 3.0 CTP1 introduces a new feature [ordered] which is somewhat a shortcut for OrderedDictionary. I cannot imagine practical use cases of it. Why is this feature really useful? Can somebody provide some useful examples?

Example: this is, IMHO, rather demo case than practical:

$a = [ordered]@{a=1;b=2;d=3;c=4}

(I do not mind if it is still useful, then I am just looking for other useful cases).

I am not looking for use cases of OrderedDictionary, it is useful, indeed. But we can use it directly in v2.0 (and I do a lot). I am trying to understand why is this new feature [ordered] needed in addition.


Collected use cases from answers:

$hash = [ordered]@{}

is shorter than

$hash = New-Object System.Collections.Specialized.OrderedDictionary

N.B. ordered is not a real shortcut for the type. New-Object ordered does not work.

N.B. 2: But this is still a good shortcut because (I think, cannot try) it creates typical for PowerShell case insensitive dictionary. The equivalent command in v2.0 is too long, indeed:

New-Object System.Collections.Specialized.OrderedDictionary]([System.StringComparer]::OrdinalIgnoreCase)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:17:22+00:00Added an answer on May 26, 2026 at 6:17 am

    First I will start by asking – Why not have them?

    I can think of a use case in my project where we use Powershell scripts for build and deploy and yml for config ( using https://github.com/scottmuc/PowerYaml )

    The config from yml is read in as hashtables. The tasks are specified in the yml like deploy to database, deploy to iis, deploy service and so on. I would like to do the database deploy and then website deploy so that I can avoid iisreset afterwards. Currently I have to explicitly look at that. Now, I can have an Ordered hash table and specify the deploy database first and hence it happens first.

    Snippet:

    function Convert-YamlMappingNodeToHash($node)
    {
        $hash = @{}
        $yamlNodes = $node.Children
    
        foreach($key in $yamlNodes.Keys)
        {
            $hash[$key.Value] = Explode-Node $yamlNodes[$key]
        }
        return $hash
    }
    

    Now the $hash =@{} become $hash=[ordered]@{}

    I don’t know how this means for a bloated product. OrderedDictionary is there in .NET ( I have lots of use cases for it in programming ) and they have just added an accelerator for it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using PowerShell, I can do: $shell = new-object -com Shell.Application $shell.GetSetting(0x2) Which correctly returns
Powershell provides the New-WebServiceProxy cmdlet which allows for a web service proxy object to
The powershell guidelines suggest avoiding the use of aliases in scripts, e.g. spelling out
In Powershell I am defining a new PSDrive called test . But when I
Wrote the following in PowersHell as a quick iTunes demonstration: $iTunes = New-Object -ComObject
I want to use Powershell to write some utilities, leveraging our own .NET components
How do I ask PowerShell where something is? For instance, which notepad and it
How do I use PowerShell to stop and start a Generic Service as seen
In PowerShell you can use [xml] to mean [System.Xml.XmlDocument]. Do you know where I
I am new to powershell, and I am trying to add error handling via

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.