PowerTip: Use PowerShell to Get Hash Code of Tuple

Summary: Learn how to get the hash code of a tuple by using Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to get the hash code for a tuple?

Hey, Scripting Guy! Answer Call the GetHashCode method from your Tuple object—for example,
            this command creates a tuple and obtains the hash code of it:

$t = [tuple]::Create(1,2)


    This can also be accomplished in a single line:


Comments (1)

  1. Andre says:

    Never heard from tuple type before! Interesting! I read that it was introduced with .NET Framework 4.
    Here I found article of building tuples:
    Do you have an example, when to use such a type in PS?

Skip to main content