Forum Discussion
ahinterl
Jul 02, 2025Brass Contributor
Array and array member methods
The following PowerShell code: class MyClass { }
class MyClass1 : MyClass {
[void] OutMsg([string] $Str) {
Write-Host -Object "MyClass1: $Str"
}
}
class MyClass2 : MyClass {
[vo...
ahinterl
Jul 03, 2025Brass Contributor
Hi Andres-Bohren​,
Use the Get-Member cmdlet with the -InputObject parameter to list the members of the array object. OutStr is not listed there.
To make sure, I transferred the code to C# and tested there: Visual Studio expectedly reports that OutStr doesn't exist for the array object (ClassArray).
So, I guess that PowerShell does some magic here. Leaves the question where else this kind of magic is applied to, and to what degree I can trust PowerShell to treat things "natively" (I for my part will check in C# if in doubt)...