sheldonhull/sheldonhull.hugo

Debugging Type Binding in PowerShell - sheldonhull.com

Closed this issue · 2 comments

I ended up here because I was looking for a PowerShell equivalent of Ruby's binding.pry

This is what I ended up using:
while ($true){ $input = Read-Host -Prompt "repl"; if ($input -eq "exit"){ return 0 }; Invoke-Expression $input }

@tasaif didn't see this until now. Sorry!
What did this help you get to?

In PowerShell, you normally use the Get-Member cmdlet to accomplish evaluation on types.
This is pretty powerful and will provide you the .NET type, methods, and more.
This Get-Member can be one of your best tools for working with PowerShell in more detail.

For another example checkout this article: consider-the-benefits-of-powershell-for-developer-workflows where I did some more examples on this. If you aren't coming from a .NET background, then maybe that will be useful in helping show a different perspective.

If you didn't get everything you need, post more here and I'll do my best to point you in the right direction, otherwise thanks for dropping by!