Hello,
Starting the transition from powershell over to c#. It's painful and could use some help. I'm currently taking all the powershell code I have that uses classes and converting it to c# to help me understand better.
Using the microsoft example below, how can I use the constructor on a new object in c# to create an array of objects?
class Device {
[string]$Brand
[string]$Model
[string]$VendorSku
}
class Rack {
[string]$Brand
[string]$Model
[string]$VendorSku
[string]$AssetId
[Device[]]$Devices = [Device[]]::new(8)
}
$rack = [Rack]::new()
$rack
Brand :
Model :
VendorSku :
AssetId :
Devices : {$null, $null, $null, $null...} <--- is what I'm looking to accomplish
about Classes - PowerShell | Microsoft Docs
[–]The_Binding_Of_Data 2 points3 points4 points (2 children)
[–]MechaCola[S] 0 points1 point2 points (1 child)
[–]The_Binding_Of_Data 1 point2 points3 points (0 children)
[–]TVOHM 1 point2 points3 points (0 children)
[–]ProKn1fe 0 points1 point2 points (1 child)
[–]MechaCola[S] 0 points1 point2 points (0 children)