PSDataCollection<T> PSDataCollection<T> PSDataCollection<T> Class

Definition

build Thread Safe buffer used with PowerShell Hosting interfaces.

public class PSDataCollection<T> : IDisposable, System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.IList, System.Runtime.Serialization.ISerializable
type PSDataCollection<'T> = class
    interface IList<'T>
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface IList
    interface ICollection
    interface IDisposable
    interface ISerializable
Public Class PSDataCollection(Of T)
Implements ICollection(Of T), IDisposable, IEnumerable(Of T), IList, IList(Of T), ISerializable
Type Parameters
T
Inheritance
PSDataCollection<T>PSDataCollection<T>PSDataCollection<T>
Implements

Constructors

PSDataCollection<T>() PSDataCollection<T>() PSDataCollection<T>()

Default Constructor

PSDataCollection<T>(IEnumerable<T>) PSDataCollection<T>(IEnumerable<T>) PSDataCollection<T>(IEnumerable<T>)

Creates a PSDataCollection that includes all the items in the IEnumerable and invokes Complete().

PSDataCollection<T>(Int32) PSDataCollection<T>(Int32) PSDataCollection<T>(Int32)

Initializes a new instance with the specified capacity capacity

PSDataCollection<T>(SerializationInfo, StreamingContext) PSDataCollection<T>(SerializationInfo, StreamingContext) PSDataCollection<T>(SerializationInfo, StreamingContext)

Creates a PSDataCollection from an ISerializable context

Properties

BlockingEnumerator BlockingEnumerator BlockingEnumerator

Indicates whether the data collection should have a blocking enumerator by default. Currently only when a PowerShell object is associated with the data collection, a reference count is added which causes the enumerator to be blocking. This prevents the use of PSDataCollection without a PowerShell object. This property fixes the same

Count Count Count

Gets the number of elements contained in the buffer

DataAddedCount DataAddedCount DataAddedCount

An int that tells the frequency of Data Added events fired. Raises the DataAdded event only when data has been added a multiple of this many times, or when collection can receive no more data, if further data is added past the last event prior to completion.

EnumeratorNeverBlocks EnumeratorNeverBlocks EnumeratorNeverBlocks

If this is set to true, then the enumerator returned from GetEnumerator() will never block.

IsAutoGenerated IsAutoGenerated IsAutoGenerated

Determines whether this PSDataCollection was created implicitly in support of data collection (for example, a workflow that wants to capture output but hasn't provided an instance of the PSDataCollection to capture it with.)

IsOpen IsOpen IsOpen

A boolean which determines if the buffer is open.

IsReadOnly IsReadOnly IsReadOnly

Gets a value indicating whether the buffer is read-only.

Item[Int32] Item[Int32] Item[Int32]

Gets or sets the element at the specified index.

SerializeInput SerializeInput SerializeInput

Serializes all input by default. This is supported only for PSDataCollections of PSObject.

Methods

Add(T) Add(T) Add(T)

Adds an item to the thread-safe buffer

Clear() Clear() Clear()

Removes all items from the buffer

Complete() Complete() Complete()

Completes insertions to the buffer. Subsequent Inserts to the buffer will result in an InvalidOperationException

Contains(T) Contains(T) Contains(T)

Determines whether the buffer contains an element with a specific value.

CopyTo(T[], Int32) CopyTo(T[], Int32) CopyTo(T[], Int32)

Copies the elements of the buffer to a specified array, starting at a particular index.

Dispose() Dispose() Dispose()

Public dispose method

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Release all the resources

GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through the elements of the buffer.

GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext)

Implements the ISerializable contract for serializing a PSDataCollection

IndexOf(T) IndexOf(T) IndexOf(T)

Determines the index of a specific item in the buffer.

Insert(Int32, T) Insert(Int32, T) Insert(Int32, T)

Inserts an item to the buffer at the specified index.

InsertItem(Guid, Int32, T) InsertItem(Guid, Int32, T) InsertItem(Guid, Int32, T)

Inserts an item into the buffer at a specified index.

ReadAll() ReadAll() ReadAll()

Makes a shallow copy of all the elements currently in this collection and clears them from this collection. This will not result in a blocking call.

Calling this method might have side effects on the enumerator. When this method is called, the behavior of the enumerator is not defined.

Remove(T) Remove(T) Remove(T)

Removes the first occurrence of a specified item from the buffer.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

Removes the item at the specified index.

RemoveItem(Int32) RemoveItem(Int32) RemoveItem(Int32)

Removes the item at a specified index

Events

Completed Completed Completed

Event fired when the buffer is completed.

DataAdded DataAdded DataAdded

Event fired when objects are done being added to the underlying buffer

DataAdding DataAdding DataAdding

Event fired when objects are being added to the underlying buffer.

Operators

Implicit(Boolean to PSDataCollection<T>) Implicit(Boolean to PSDataCollection<T>) Implicit(Boolean to PSDataCollection<T>)
Implicit(Byte to PSDataCollection<T>) Implicit(Byte to PSDataCollection<T>) Implicit(Byte to PSDataCollection<T>)
Implicit(Hashtable to PSDataCollection<T>) Implicit(Hashtable to PSDataCollection<T>) Implicit(Hashtable to PSDataCollection<T>)
Implicit(Int32 to PSDataCollection<T>) Implicit(Int32 to PSDataCollection<T>) Implicit(Int32 to PSDataCollection<T>)
Implicit(Object[] to PSDataCollection<T>) Implicit(Object[] to PSDataCollection<T>) Implicit(Object[] to PSDataCollection<T>)
Implicit(String to PSDataCollection<T>) Implicit(String to PSDataCollection<T>) Implicit(String to PSDataCollection<T>)
Implicit(T to PSDataCollection<T>) Implicit(T to PSDataCollection<T>) Implicit(T to PSDataCollection<T>)

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

Copies the elements of the collection to a specified array, starting at a particular index.

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

Gets a value that indicates whether the buffer is synchronized.

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

Gets the object used to synchronize access to the thread-safe buffer

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

Returns an enumerator that iterates through the buffer.

IList.Add(Object) IList.Add(Object) IList.Add(Object)

Adds an element to the buffer.

IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

Determines whether the collection contains an element with a specific value.

IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

Determines the zero-based index of an element in the buffer.

IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

Inserts an object into the buffer at a specified index.

IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

Gets a value that indicates whether the buffer is fixed in size.

IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly

Gets a value that indicates whether the buffer is read-only.

IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

Gets or sets the element at the specified index.

IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

Removes the first occurrence of a specified object as an element from the buffer.

Applies to