## XSICollection.RemoveItems

### Description

Removes one or more items to the collection. Compare this method to XSICollection.Remove, which only removes a single item at a time and XSICollection.RemoveAll which empties the collection completely.

### C# Syntax

    Object XSICollection.RemoveItems( Object in_newVal );

### Scripting Syntax

    oReturn = XSICollection.RemoveItems( Items );

### Return Value

The removed items as an XSICollection.

### Parameters

Parameter | Type | Description
--- | --- | ---
Items | XSICollection, Array or object name | The items to remove.

### Examples

#### 1. VBScript Example

    Dim oColl1            ' object pointer for first collection
    Dim oColl2              ' object pointer for second collection
    Dim aItems              ' array of items to add all at once
    ' Create the first collection & populate it
    Set oColl1 = CreateObject( "XSI.Collection" )
    oColl1.SetAsText "Camera,Light"
    checkContents oColl1
    ' Create the second collection & populate it
    LogMessage "----------------"
    Set oColl2 = CreateObject( "XSI.Collection" )
    oColl2.AddItems oColl1
    ' Since the Unique property hasn't been set to True, we can
    ' add another instance of the camera to the collection
    oColl2.Add "Camera"
    checkContents oColl2
    ' Remove the light and one instance of the camera
    LogMessage "----------------"
    oColl2.RemoveItems oColl1
    checkContents oColl2
    '--------------------------------------------------
    function checkContents( in_coll )
            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 : "Collection now contains Camera,light"
    'INFO : "----------------"
    'INFO : "Collection now contains Camera,light,Camera"
    'INFO : "----------------"
    'INFO : "Collection now contains Camera"

#### 2. JScript Example

    /*
            This example demonstrates how to split a collection into 2
    */
    NewScene( null, false );
    // ----------------------------------------------------
    // Create a collection & populate it
    var oFolks = new ActiveXObject( "XSI.Collection" );
    var oSammy = ActiveSceneRoot.AddNull( "Sammy" );
    oFolks.Add( oSammy );
    var oRoger = ActiveSceneRoot.AddNull( "Roger" );
    oFolks.Add( oRoger );
    var oBelinda = ActiveSceneRoot.AddNull( "Belinda" );
    oFolks.Add( oBelinda );
    var oAgnes = ActiveSceneRoot.AddNull( "Agnes" );
    oFolks.Add( oAgnes );
    // This will tell us that Sammy, Roger, Belinda, and Agnes
    // are all members of the folks collection
    checkContents( oFolks, "oFolks" );
    Application.LogMessage( "----------------" );
    // ----------------------------------------------------
    // Remove Sammy and Roger and save the removed ones
    // in another collection, leaving the original with the
    // two women and the new collection with two men
    var oMen = oFolks.RemoveItems( "Sammy,Roger" );
    checkContents( oFolks, "oFolks" );
    checkContents( oMen, "oMen" );
    //--------------------------------------------------
    function checkContents( in_coll, in_id )
    {
            if ( in_coll.Count > 0 )
            {
                    LogMessage( in_id + " collection contains: " + in_coll.GetAsText() );
            }
            else
            {
                    Application.LogMessage( in_id + " collection is empty." );
            }
    }
    //--------------------------------------------------
    // Output of above script:
    //INFO : "oFolks collection contains: Sammy,Roger,Belinda,Agnes"
    //INFO : "----------------"
    //INFO : "oFolks collection contains: Belinda,Agnes"
    //INFO : "oMen collection contains: Sammy,Roger"

### See Also

XSICollection.Unique XSICollection.Remove XSICollection.RemoveAll