Reputation: 788
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 > ??
Upvotes: 1
Views: 1391
Reputation: 788
I found the solution for this
new ArrayList(((ArrayList)(((PSObject)(vNetworkAdapter.Members["IPv4Addresses"].Value)).BaseObject)))
Upvotes: 1