Is it possible to write extension method in PowerShell? or to bolt a new method on top of an existing type like [string] live at runtime?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t know of a way to patch a type with an extension method. But it’s certainly possible to patch an object via the add-member cmdlet
EDIT Explain the completely and totally readable PowerShell Syntax 🙂
I love PowerShell but it really does come up with cryptic syntax from time to time.
$a.$anow has the method you added