简体   繁体   中英

How to get values of array by powershell from Visual Studio

Defined double array:

double[] doubleArray = {0.0, 1.0, 2.0};

During debugging (VS2013) in "Package Manager Console" created varaible $doubleArray:

$doubleArray = $dte.Debugger.CurrentStackFrame.Locals | Where-Object {$_.name -Match "doubleArray"}

How can I get all values of the array via powershell?

Unfortunately "value" is only a String:

Capture VS local variables while debugging in EnvDTE

Obviosly there is nothing more to it than just that string. It looks like, before handing the result over to the PowerShell-Window a ToString() is done, so it is no longer an object that can be expanded.

PM> $doubleArray.value | Select *

Length
------
11

or:

PM> $doubleArray | Select value -ExpandProperty Value

{double[3]}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM