< Back
Test-CTypeIsDefined
Post
NAME Test-CTypeIsDefined
SYNOPSIS
Test whether a CType type is already defined.
SYNTAX
Test-CTypeIsDefined [-TypeName] <String> [<CommonParameters>]
DESCRIPTION
Test whether a CType type is already defined.
Note that types may not be removed from a PowerShell session once defined.
PARAMETERS
-TypeName <String>
Name for the type.
Required? true
Position? 1
Default value
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
OUTPUTS
System.Boolean
NOTES
This method is fast, but it only detects CType types, not .NET types generally.
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>if (-not (Test-CTypeIsDefined MyCompany.MyNamespace.ClassName))
{
CType MyCompany.MyNamespace.ClassName2 {
CTypeProperty int Property1
CTypeProperty string Property2
CTypeProperty boolean Property3
}
}
RELATED LINKS
CType
Add-CType
SYNOPSIS
Test whether a CType type is already defined.
SYNTAX
Test-CTypeIsDefined [-TypeName] <String> [<CommonParameters>]
DESCRIPTION
Test whether a CType type is already defined.
Note that types may not be removed from a PowerShell session once defined.
PARAMETERS
-TypeName <String>
Name for the type.
Required? true
Position? 1
Default value
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
OUTPUTS
System.Boolean
NOTES
This method is fast, but it only detects CType types, not .NET types generally.
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>if (-not (Test-CTypeIsDefined MyCompany.MyNamespace.ClassName))
{
CType MyCompany.MyNamespace.ClassName2 {
CTypeProperty int Property1
CTypeProperty string Property2
CTypeProperty boolean Property3
}
}
RELATED LINKS
CType
Add-CType