Search code examples
wmic++-cxsystem.management

C++/CX WMI PropertyData array type


I need to read the values of System.Management.PropertyData when it's an array.

PropertyData.IsArray Property

https://learn.microsoft.com/en-us/dotnet/api/system.management.propertydata.isarray?view=netframework-4.7.2

I have no idea how to convert PropertyData.Value to something readable. If I print PropertyData.Value as it is, I get a "System.String[]"

If I convert it to array<String>

for each(String s in (array<String>^)(object->Properties[propertyName]->Value))
    Console::WriteLine(s);

I get a

Error (active) the element type of a cli::array must be a handle or value type

Any help would be appreciated.


Solution

  • This is simply a syntax error.

    The correct form is

    for each (String^ s in (array<String^>^)...