Does powershell have a method_missing () method?

I play with powershell dynamic capabilities and I was interested in something

Is there anything in powershell similar to Ruby method_missing () where you can configure the “catch all” method to dynamically handle calls to nonexistent methods on your objects?

+3
source share
3 answers

No, not at all. I suspect that the next version of PowerShell will be more in line with the dynamic sending capabilities added in .NET 4, but for now this will not be possible in pure PowerShell.

, , , .NET TypeDescriptor , PowerShell. , XML- , , . , , /, , .

+2

, . : Add-RelativePathCapture http://poshcode.org/2131 New-CommandWrapper http://poshcode.org/2197.

, New-CommandWrapper. , Out-Default, ( , Format-Table ). Out-Default , , , / . method_missing.

+1

Source: https://habr.com/ru/post/1761771/


All Articles