< Back

Find-Type

Mon Jan 13, 2020 3:03 am

NAME Find-Type



SYNOPSIS

Find .NET classes in the AppDomain.





SYNTAX

Find-Type [[-Namespace] <String>] [-FilterScript <ScriptBlock>] [-Force] [-FullName <String>]

[-ImplementsInterface <Type>] [-InheritsType <Type>] [-InputObject <PSObject>] [-Not] [-RegularExpression]

[<CommonParameters>]



Find-Type [[-Namespace] <String>] [-Force] [-FullName <String>] [-ImplementsInterface <Type>] [-InheritsType

<Type>] [-InputObject <PSObject>] [-Name <String>] [-Not] [-RegularExpression] [<CommonParameters>]





DESCRIPTION

The Find-Type cmdlet searches the AppDomain for .NET classes that match specified criteria.





PARAMETERS

-FilterScript <ScriptBlock>

Specifies a ScriptBlock to invoke as a filter. The variable "$_" or "$PSItem" contains the current type to

evaluate.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Force [<SwitchParameter>]

If specified nonpublic types will also be matched.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-FullName <String>

Specifies the full name including namespace to match.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-ImplementsInterface <Type>

Specifies a interface that the type must implement to match.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InheritsType <Type>

Specifies a type that the type must inherit to match.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InputObject <PSObject>

Specifies the current object to evaluate.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-Name <String>

Specifies the name of the type to match. For example, the name of the type "System.Text.StringBuilder" is

"StringBuilder".



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-Namespace <String>

Specifies the namespace to match. For exmaple, the namespace of the type "System.Text.StringBuilder" is

"System.Text".



Required? false

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? true



-Not [<SwitchParameter>]

Specifies that this cmdlet should only return object that do not match the criteria.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-RegularExpression [<SwitchParameter>]

If specified all parameters that accept wildcards will match regular expressions instead.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

ClassExplorer.NamespaceInfo, System.Reflection.Assembly, System.Type, PSObject

If you pass NamespaceInfo objects to this cmdlet it will match types declared in that namespace.



If you pass assemblies to this cmdlet it will match types from that assembly.



If you pass Type objects as input this cmdlet will return the input if it matches the specified criteria. You

can use this to chain Find-Type commands to filter output.



If you pass any other object to this cmdlet it will return the type of that object.





OUTPUTS

System.Type

Matched Type objected will be returned to the pipeline.





NOTES









-------------------------- EXAMPLE 1 --------------------------



$types = Find-Type

$types.Count



# 5106



Find all the types currently loaded in the AppDomain.

-------------------------- EXAMPLE 2 --------------------------



Find-Type -InheritsType System.Management.Automation.Runspaces.RunspaceConnectionInfo



# IsPublic IsSerial Name BaseType

# -------- -------- ---- --------

# True False WSManConnectionInfo System.Management.Automation.Runspac...

# True False NamedPipeConnectionInfo System.Management.Automation.Runspac...

# True False SSHConnectionInfo System.Management.Automation.Runspac...

# True False VMConnectionInfo System.Management.Automation.Runspac...

# True False ContainerConnectionInfo System.Management.Automation.Runspac...



Find all types that inherit the class RunspaceConnectionInfo.

-------------------------- EXAMPLE 3 --------------------------



Find-Type -Interface -Namespace System.Management.Automation {

Find-Member -InputObject $_ -ParameterType System.Management.Automation.Language.Ast

}



# IsPublic IsSerial Name BaseType

# -------- -------- ---- --------

# True False IArgumentCompleter



Find all interfaces in the namespace System.Management.Automation that have a member that takes an AST as a

parameter.



RELATED LINKS

Online Version: https://github.com/SeeminglyScience/Cla ... nd-Type.md

Find-Member

Find-Namespace

Get-Assembly

Get-Parameter