Detect -Debug and -Verbose function parameters in VB.NET

被刻印的时光 ゝ 提交于 2019-12-11 08:06:01

问题


I am using Microsoft Visual Studio 2008 Visual Basic, and am creating a custom PowerShell Cmdlet.

How do I detect if either the -Verbose or -Debug parameters are used? I have tried If Debug.IsPresent Then, but that does not appear to work.


回答1:


You have to examine the parameters that are passed into the cmdlet. Use the $PSBoundParameters automatic variable to determine which parameters were specified.

For more information, see: Get-Help -Name about_Automatic_Variables;




回答2:


It is not VB.Net, but here is a solution in C# which should translate to VB.Net with ease



来源:https://stackoverflow.com/questions/20815693/detect-debug-and-verbose-function-parameters-in-vb-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!