PoshCode Logo PowerShell Code Repository

Get-StaticMethodDefin (modification of post by Steven Murawski view diff)
diff | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/968"></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. #Examples:
  6. # get-staticmethoddefinition max math
  7. # [math] | get-staticmethoddefinition max
  8.  
  9. function Get-StaticMethodDefinition()
  10. {
  11.         param ([string[]]$Method, [Type]$Type=$null)
  12.         BEGIN
  13.         {
  14.                 if ($Type -ne $null)
  15.                 {
  16.                         $Type | Get-StaticMethodDefinition $Method
  17.                 }
  18.         }
  19.        
  20.         PROCESS
  21.         {
  22.                 if ($_ -ne $null)
  23.                 {
  24.                         $_ | Get-Member -Name $Method -Static -MemberType Method | ForEach-Object {$_.Definition -replace '\), ', "), `n"}
  25.                 }
  26.         }
  27. }

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