"Bob Landau" <BobLandau@xxxxxx> wrote in message
news:BDF5AE5A-E2D6-482C-B92D-74C712DAB6CB@xxxxxx
> The obvious way is simply let the powershell type system do the work as in
>
> [int] | Get-FrameWorkHelp
>
> Unfortuately there are many many types (100's) such as [Assembly],
> [ArrayList], [Calendar], ..... to name just a few that are not loaded
> into
> the default Powershell host. None of these can be passed via a pipe
> because
> the type must be known. I'm not following you. Assembly is in mscorlib so it does get loaded by
PoSh by default.
PS> [Reflection.Assembly] | gm -static
TypeName: System.Reflection.Assembly
Name MemberType Definition
---- ---------- ----------
CreateQualifiedName Method static System.String
CreateQualifiedName(String assemblyName, String typeName)
Equals Method static System.Boolean Equals(Object objA,
Object objB)
....
> However you can use the statement at the end of this post to enumerating
> any
> valid type as _long_ as you know the name which is why the purpose of this
> post
>
> This is the rough outline of what I have
>
> Get-FrameWorkHelp ( [object] $Type = $null, [switch] $typeName,)
> {
> if (the pipes not empty)
> {
> read from the pipe and call the UnderlyingSysteType to find the
> actual type
> }
> elseif ($Type has a valid type form "[some type]" and $TypeName is
> true)
> {
> How do I determine what the underlying type of "[int]"
>
> $Type will _always be a string type regardless of whether its in
> square
> brackets or not.
> }
> }
>
> I've not found enumerating the .Net namespace to work very well the below
> statement simply returns too much and changing the -like to -eq returns
> nothing
>
> [appdomain]::currentdomain.GetAssemblies() | ForEach {$_.GetTypes()} |
> Where
> {$_.Name -like 'int*'}
> You would get less "noise" if you filtered out non-public types by using
GetExportedTypes() instead:
PS> [System.AppDomain]::CurrentDomain.GetAssemblies() |
%{$_.GetExportedTypes()} | ?{$_.Name -match '^int\d'}
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Int16 System.ValueType
True True Int32 System.ValueType
True True Int64 System.ValueType
True False Int16Converter
System.ComponentModel.BaseNumberConverter
True False Int32Converter
System.ComponentModel.BaseNumberConverter
True False Int64Converter
System.ComponentModel.BaseNumberConverter
True False Int32Aggregator System.ValueType
True False Int64Aggregator System.ValueType
--
Keith