Compartir a través de


PSDataCollection<T> Class

Definition

build Thread Safe buffer used with PowerShell Hosting interfaces.

generic <typename T>
public ref class PSDataCollection : IDisposable, System::Collections::Generic::ICollection<T>, System::Collections::Generic::IEnumerable<T>, System::Collections::Generic::IList<T>, System::Collections::IList, System::Runtime::Serialization::ISerializable
[System.Serializable]
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
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
[<System.Serializable>]
type PSDataCollection<'T> = class
    interface IList<'T>
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface IList
    interface ICollection
    interface IDisposable
    interface ISerializable
type PSDataCollection<'T> = class
    interface ICollection<'T>
    interface seq<'T>
    interface IEnumerable
    interface IList<'T>
    interface ICollection
    interface IList
    interface IDisposable
    interface 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>
Attributes
Implements

Constructors

PSDataCollection<T>()

Default Constructor.

PSDataCollection<T>(IEnumerable<T>)

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

PSDataCollection<T>(Int32)

Initializes a new instance with the specified capacity capacity

PSDataCollection<T>(SerializationInfo, StreamingContext)

Creates a PSDataCollection from an ISerializable context.

Properties

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

Gets the number of elements contained in the buffer.

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

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

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

A boolean which determines if the buffer is open.

IsReadOnly

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

Item[Int32]

Gets or sets the element at the specified index.

SerializeInput

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

Methods

Add(T)

Adds an item to the thread-safe buffer.

Clear()

Removes all items from the buffer.

Complete()

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

Contains(T)

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

CopyTo(T[], Int32)

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

Dispose()

Public dispose method.

Dispose(Boolean)

Release all the resources.

GetEnumerator()

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

GetObjectData(SerializationInfo, StreamingContext)

Implements the ISerializable contract for serializing a PSDataCollection.

IndexOf(T)

Determines the index of a specific item in the buffer.

Insert(Int32, T)

Inserts an item to the buffer at the specified index.

InsertItem(Guid, Int32, T)

Inserts an item into the buffer at a specified index.

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)

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

RemoveAt(Int32)

Removes the item at the specified index.

RemoveItem(Int32)

Removes the item at a specified index.

Operators

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

Events

Completed

Event fired when the buffer is completed.

DataAdded

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

DataAdding

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

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32)

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

ICollection.IsSynchronized

Gets a value that indicates whether the buffer is synchronized.

ICollection.SyncRoot

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

IEnumerable.GetEnumerator()

Returns an enumerator that iterates through the buffer.

IList.Add(Object)

Adds an element to the buffer.

IList.Contains(Object)

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

IList.IndexOf(Object)

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

IList.Insert(Int32, Object)

Inserts an object into the buffer at a specified index.

IList.IsFixedSize

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

IList.IsReadOnly

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

IList.Item[Int32]

Gets or sets the element at the specified index.

IList.Remove(Object)

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

Applies to