Search code examples
c#.netgenericspowershell-remoting

PSObject conversion Deserialized.System.Collections.Generic.List


In c# am trying to call a power shell command-let and converting into C# objects and processing the data ....

Calling

Get-SCVirtualNetworkAdapter -All

One of the Response Object :

IPv4Addresses                              : {12.12.12.12}

And MemberType is

Deserialized.System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] Property

How to cast particular PSObject into string , List < String > ??


Solution

  • I found the solution for this

    new ArrayList(((ArrayList)(((PSObject)(vNetworkAdapter.Members["IPv4Addresses"].Value)).BaseObject)))