I wish to create an array of events in a calendar. Both Event and Calendar are Objects. I couldn't find any documentation for the creation of a simple array in an Object.
1 Answer
How about something like this -
$cal = New-Object -Type PsObject -Prop @{
Year = 2013
Events = @()
}
$event = New-Object -Type PsObject -Prop @{
Date = [DateTime] "2013-02-14"
Name = "Valentines Day"
}
$cal.Events += $event
If you have a predefined calendar objects which doesn't have a property to store events you can use Add-Member to attach a new property and store an array in there.