What is :: ?

Welcome Forums General PowerShell Q&A What is :: ?

This topic contains 2 replies, has 2 voices, and was last updated by

3 years, 11 months ago.

  • Author
  • #23141

    Points: 0
    Rank: Member

    Hi all,

    This is my first post !
    In the line [System.Windows.Forms.MessageBox]::Show("Hello World!") what does the :: mean/do ?
    Also, why is there the need to use "System.Windows.Forms.MessageBox" and not a verb-noun syntax ? What is the difference ?

    Many thanks all !

  • #23142

    Points: 60
    Rank: Member

    Hi Graham,

    You are referring to a .NET class, which will often require you to specify it's entire name space as well. The '::' tells PowerShell that what follows is one of the attributes of the class, which typically can consists of one or more constructors, enumerations, methods, or properties.

    Take a look at https://msdn.microsoft.com/en-us/library/system.windows.forms.messagebox%28v=vs.110%29.aspx to get an idea what I'm referring to.

    This is also the reason why there is no Verb-Noun format. You're not referring to a PowerShell cmdlet, but directly to a .NET class.

    If you want to get a list of currently registered cmdlets, you can use the Get-Command Cmdlet.

    There's some pretty good articles available about using .NET with PowerShell. Take a look at Scripting Guy who has written a few.

    Hope this helps.

  • #23143

    Points: 0
    Rank: Member

    Many thanks

The topic ‘What is :: ?’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort