我希望在日历中创建一系列事件。事件和日历都是对象。我找不到任何关于在对象中创建简单数组的文档。
问问题
760 次
1 回答
3
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.
于 2013-02-14T01:04:35.560 回答