Windows Dev Center

The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

PSDataCollection.Complete Method

Completes the process of adding content to the collection. This method must be called before the collection can be used to invoke a pipeline asynchronously. This method is introduced in Windows PowerShell 2.0.

Namespace: System.Management.Automation
Assembly: System.Management.Automation (in System.Management.Automation.dll)

Dim instance As PSDataCollection(Of T)


public void Complete ()
public void Complete ()
public function Complete ()

The following example shows how to add input data for the first command in the pipeline. In this case, integers are added to the collection, and then those integers are sorted by the Sort-Object cmdlet.

PSDataCollection<int> input =
    new PSDataCollection<int>();

// Create an IAsyncResult object and call the
// BeginInvoke method to start invoking the 
// pipeline asynchronously.
IAsyncResult async = ps.BeginInvoke<int>(input);

// Using the PowerShell.Invoke method, run the 
// pipeline using the default runspace.
foreach (PSObject result in ps.EndInvoke(async))
} // End foreach.

Subsequent inserts to the buffer will result in an InvalidOperationException.

This collection is typically used to create an input buffer that is used when invoking a pipeline of commands asynchronously.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Target Platforms

© 2015 Microsoft