PoshCode Logo PowerShell Code Repository

Get-StaticMethodDefin by Steven Murawski 35 months ago
View followups from Steven Murawski | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/967"></script>download | new post

Helper function to list the definitions of static methods

  1. #Steven Murawski
  2. #http://blog.usepowershell.com
  3. #03/20/2009
  4.  
  5. function Get-StaticMethodDefinition()
  6. {
  7.         param ($Method, [Type]$Type=$null)
  8.         BEGIN
  9.         {
  10.                 if ($Type -ne $null)
  11.                 {
  12.                         $Type | Get-StaticMethodDefinition $Method
  13.                 }
  14.         }
  15.        
  16.         PROCESS
  17.         {
  18.                 if ($_ -ne $null)
  19.                 {
  20.                         $_ | Get-Member -Name $Method -Static -MemberType Method | ForEach-Object {$_.Definition -replace '\), ', "), `n"}
  21.                 }
  22.         }
  23. }

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me