Functions/Test-GenericList.ps1
|
<#
.SYNOPSIS Test for generic List .DESCRIPTION Test whether a given value is derived from System.Collections.Generic.List .PARAMETER Value Any value .INPUTS Object .OUTPUTS bool .NOTES Author: vike #> function Test-GenericList($Value) { if ($null -ne $Value) { for ($t = $Value.GetType(); $t; $t = $t.BaseType) { if ( $t.IsGenericType -and $t.GetGenericTypeDefinition() -eq [System.Collections.Generic.List``1] ){ return $true } } } return $false } |