Add to Technorati Favorites
Welcome to ThePowerShellGuy.com Sign in | Join | Help

PowerShell : typeInfo quiz answer

The answer to PowerShell : typeInfo quiz  was :

 

PoSH> Update-TypeData C:\PowerShell\TypeData\Typedata_Type.ps1xml   
            
PoSH> [random].typeInfo                                             
System.Random                                                                   
                                                                                                                                                               
Constructors                                                                    
                                                                                                                                                               
Void .ctor()                                                                    
Void .ctor(Int32)                                                               
                                                                                                                                                               
Methods                                                                         
                                                                                                                                                               
                                                                                                                                                             
   TypeName: System.Random                                                      
                                                                                
Name            MemberType Definition                                           
----            ---------- ----------                                           
Equals          Method     static System.Boolean Equals(Object objA, Object ... 
ReferenceEquals Method     static System.Boolean ReferenceEquals(Object objA... 
                                                                                
                                                                                
PoSH>                            
                 

 

*note* you that you also have tabcompletion on this afterwards (with PowerTab that is ;-) )

the content of the TypaDatefile  ( TypeData_Type.PS1XML ) file

 

 

<?xml version="1.0" encoding="utf-8" ?> 
<Types> 
    <Type> 
        <Name>System.Type</Name> 
        <Members> 
            <ScriptProperty> 
                <Name>TypeInfo</Name> 
                 <GetScriptBlock> 
                     $this.FullName
                     "`nConstructors`n"
                     $this.GetConstructors() |% {"$_"}
                     "`nMethods`n" 
                     $this | gm -s | ft
                </GetScriptBlock> 
            </ScriptProperty> 
        </Members> 
    </Type> 
</Types>

 

 

Enjoy,

Greetings /\/\o\/\/

Published Thursday, February 01, 2007 4:24 PM by admin
Filed under: , ,

Comments

# re: PowerShell : typeInfo quiz answer

Very convenient MOW.  I was just getting ready to track that down.

Extending types is one of the really great features of PoSH.

Keep up the great work.

Thursday, February 01, 2007 9:14 PM by Jim V
Anonymous comments are disabled