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\/\/