XSICollection.AddItems

説明

1 つまたは複数の項目をコレクションに追加します。このメソッドを、XSICollection.Add(一度に1 つだけ項目を追加)やXSICollection.SetAsText(全項目を文字列リストに追加)と比較してください。

スクリプト 構文

XSICollection.AddItems( Items );

パラメータ

パラメータ タイプ 詳細
Items XSICollectionArrayまたはobject name 追加する項目

VBScript の例

Dim oColl             ' object pointer for collection
Dim aItems              ' array of items to add all at once
' Create the new collection & populate it using SetAsText
Set oColl = CreateObject( "XSI.Collection" )
oColl.SetAsText "Camera,Light"
checkContents oColl
' Clear it and add the items again using Add
oColl.RemoveAll
checkContents oColl
oColl.Add "light"
oColl.Add "camera"
checkContents oColl
' Clear it again and add the items using AddItems
oColl.RemoveAll
aItems = Array( "Camera", "Light" )
oColl.AddItems aItems 
checkContents oColl
'--------------------------------------------------
function checkContents( in_coll )
        LogMessage "----------------"
        If in_coll.Count > 0 Then
                LogMessage "Collection now contains " & in_coll.GetAsText 
        Else
                LogMessage "Collection is empty."
        End If
end function
'--------------------------------------------------
' Output of above script:
'INFO : "----------------"
'INFO : "Collection now contains Camera,light"
'INFO : "----------------"
'INFO : "Collection is empty."
'INFO : "----------------"
'INFO : "Collection now contains light,Camera"
'INFO : "----------------"
'INFO : "Collection now contains Camera,light"

関連項目

XSICollection.GetAsText XSICollection.Add XSICollection.RemoveItems