9

Aside from its natural use, i.e. addition of two arguments, you can also use a plus + sign in Powershell to do special calls like this one:

[System.Net.WebRequestMethods+Ftp]::UploadFile

UploadFile is a public static field, according to MSDN, hence the double colon :: - everything is clear so far. But why is Ftp class so special, that instead of a dot ., it needs a +? I could not find any documentation on this part (official or not).

Are there any other uses for + except WebRequestMethods+Ftp?

Victor Zakharov
  • 25,801
  • 18
  • 85
  • 151

1 Answers1

11

The WebRequestMethods class is a container, it contains the FTP class. FTP itself is a nested-class, and to access the nested-class in PowerShell (or C#, for that matter) you must use the + notation. For more information see Plus (+) in .NET Class Names.

AMissico
  • 21,470
  • 7
  • 78
  • 106
David Brabant
  • 41,623
  • 16
  • 83
  • 111