| external help file | ISpy.dll-Help.xml |
|---|---|
| Module Name | ISpy |
| online version | https://github.com/trackd/ISpy/blob/main/docs/en-US |
| schema | 2.0.0 |
Resolves methods, cmdlets, and types from pipeline input and streams decompiled C# source for the resolved members.
Expand-Type [[-InputObject] <PSObject>] [-Path <String>] [-TypeName <String>] [-MethodName <String>] [-Metadata] [-IncludeXml] [-Settings <DecompilerSettings>] [-Decompiler <CSharpDecompiler>] [<CommonParameters>]Expand-Type accepts a variety of inputs from the pipeline and resolves them to types or method targets for decompilation. Supported input forms include System.Reflection.MethodBase, PSMethod (method group adapters), CommandInfo (cmdlet/alias), Type, delegates, and collections of these objects. When method targets are identified the cmdlet decompiles them (grouping by assembly when appropriate) and emits the resulting C# source.
This cmdlet is useful for interactively inspecting implementations discovered via tab-completion, Get-Command, Get-ChildItem, or other pipeline-producing commands.
[math]::Truncate | Expand-TypeResolves the Truncate overloads on System.Math and prints the decompiled C# bodies for the overloads.
Get-Command Get-ChildItem | Expand-TypeResolves the implementing type for the cmdlet and decompiles the relevant methods.
Expand-Type -Path "C:\libs\MyLib.dll" -TypeName "MyNamespace.MyClass"Decompiles the specified type from the provided assembly.
Expand-Type -TypeName "System.Management.Automation.LanguagePrimitives"Resolves the type from loaded assemblies in the current PowerShell process and decompiles it.
[math]::Round | Expand-Type -MetadataEmits a metadata object describing the resolved assembly path, declaring type, method names and metadata tokens, and does not print the source when -Metadata is specified.
[System.Management.Automation.Host.PSHostUserInterface]::GetFormatStyleString | Expand-Type -IncludeXmlIncludes XML documentation comments in the emitted decompiled source. By default, XML comments are not included.
The input object to resolve. Accepts PSObject, MethodBase, PSMethod, CommandInfo, Type, delegates, and collections of these. Accepts pipeline input by value.
Type: PSObject
Required: False
Position: 0
Accept pipeline input: True (ByValue)Path to the assembly that contains the target type. When provided the cmdlet will resolve types and methods against the specified assembly path. Alias: PSPath, Path.
Type: String
Required: False
Position: Named
Accept pipeline input: True (ByPropertyName)Full name of the type that contains the target method (for explicit lookups) or the type to decompile when -MethodName is not specified.
Type: String
Required: False
Position: NamedMethod name to filter overloads by. If omitted, the cmdlet will decompile the resolved type (when available) or all resolved method targets.
Type: String
Required: False
Position: NamedWhen present, emits a metadata object (assembly path, declaring type, method names, metadata tokens) alongside the source text.
Type: SwitchParameter
Required: FalseWhen present, includes XML documentation comments in decompiled output. By default, XML comments are omitted.
Type: SwitchParameter
Required: FalseCustom DecompilerSettings used when creating decompiler instances for decompilation.
When -Settings or -Decompiler is provided, Expand-Type emits the raw decompiler output and does not apply additional post-processing (for example, using-directive removal or header comment shaping).
Type: DecompilerSettings
Required: False
Position: NamedCustom CSharpDecompiler instance to use instead of creating one from path-based defaults.
Type: CSharpDecompiler
Required: False
Position: NamedSystem.Object (various) — accepts method, type, command, and PS adapter objects from the pipeline.
- Default:
System.String— When called without-Metadatathe cmdlet emits the decompiled C# source as plain text so it can be piped to formatters or renderers. - Metadata:
ISpy.Models.ISpyDecompilationResult— When-Metadatais used the cmdlet emits anISpyDecompilationResultobject containingAssemblyPath,TypeName,MethodNames,MetadataTokens,Source(if present), and other metadata.
- The cmdlet attempts ergonomic resolution of common PowerShell pipeline objects (
PSMethod,CommandInfo,MethodBase,Type). - When multiple method targets are resolved from the input the cmdlet groups them by assembly and performs a single decompiler pass per assembly for efficient output and to avoid repeated using directives.