Powershell中加号(+)的特殊使用 [英] Special use of plus (+) sign in Powershell

查看:91
本文介绍了Powershell中加号(+)的特殊使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了它的自然用途,即添加两个参数之外,您还可以在 Powershell 中使用加号 + 来执行这样的特殊调用:

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 是一个公共静态字段,根据到 MSDN,因此是双冒号 :: - 到目前为止一切都很清楚.但是为什么Ftp 类如此特别,它需要一个+ 而不是一个点.?我找不到关于这部分的任何文档(官方与否).

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).

+ 除了 WebRequestMethods+Ftp 还有其他用途吗?

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

推荐答案

WebRequestMethods 类是一个容器,它包含 FTP 类.FTP 本身是一个嵌套类,要访问 PowerShell(或 C#,就此而言)中的嵌套类,您必须使用 + 表示法.更多信息此处.

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. More information here.

这篇关于Powershell中加号(+)的特殊使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆