ImmutableStack<T> 类

定义

表示不可变堆栈。Represents an immutable stack.

NuGet 包System.Collections.Immutable关于不可变集合和安装方法NuGet package: System.Collections.Immutable (about immutable collections and how to install)

generic <typename T>
public ref class ImmutableStack sealed : System::Collections::Generic::IEnumerable<T>, System::Collections::Immutable::IImmutableStack<T>
public sealed class ImmutableStack<T> : System.Collections.Generic.IEnumerable<T>, System.Collections.Immutable.IImmutableStack<T>
type ImmutableStack<'T> = class
    interface seq<'T>
    interface IEnumerable
    interface IImmutableStack<'T>
Public NotInheritable Class ImmutableStack(Of T)
Implements IEnumerable(Of T), IImmutableStack(Of T)

类型参数

T

堆栈上的元素的类型。The type of element on the stack.

继承
ImmutableStack<T>
实现

属性

Empty

获取空的不可变堆栈。Gets an empty immutable stack.

IsEmpty

获取一个值,该值指示此不可变堆栈实例是否为空。Gets a value that indicates whether this instance of the immutable stack is empty.

方法

Clear()

从不可变堆栈中移除所有对象。Removes all objects from the immutable stack.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetEnumerator()

返回一个循环访问不可变堆栈的枚举器。Returns an enumerator that iterates through the immutable stack.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
Peek()

返回位于堆栈顶部的对象但不将其移除。Returns the object at the top of the stack without removing it.

PeekRef()

获取对堆栈顶部的元素的只读引用。Gets a read-only reference to the element on the top of the stack.

Pop()

移除位于不可变堆栈顶部的元素,并返回完成移除操作后的堆栈。Removes the element at the top of the immutable stack and returns the stack after the removal.

Pop(T)

从不可变堆栈中移除指定的元素,并返回完成移除操作后的堆栈。Removes the specified element from the immutable stack and returns the stack after the removal.

Push(T)

将对象插入到不可变堆栈的顶部,并返回新堆栈。Inserts an object at the top of the immutable stack and returns the new stack.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

显式界面实现

IEnumerable.GetEnumerator()

返回循环访问集合的枚举数。Returns an enumerator that iterates through a collection.

IEnumerable<T>.GetEnumerator()

返回一个循环访问集合的枚举器。Returns an enumerator that iterates through the collection.

IImmutableStack<T>.Clear()

从不可变堆栈中移除所有元素。Removes all elements from the immutable stack.

IImmutableStack<T>.Pop()

移除位于不可变堆栈顶部的元素,并返回新堆栈。Removes the element at the top of the immutable stack and returns the new stack.

IImmutableStack<T>.Push(T)

在不可变堆栈顶部插入一个元素,并返回新堆栈。Inserts an element at the top of the immutable stack and returns the new stack.

扩展方法

Pop<T>(IImmutableStack<T>, T)

从不可变堆栈中移除指定的项。Removes the specified item from an immutable stack.

CopyToDataTable<T>(IEnumerable<T>)

在给定其泛型参数 TDataTable 的输入 DataRow 对象的情况下,返回包含 IEnumerable<T> 对象副本的 DataRowReturns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

Ancestors<T>(IEnumerable<T>)

返回元素集合,其中包含源集合中每个节点的上级。Returns a collection of elements that contains the ancestors of every node in the source collection.

Ancestors<T>(IEnumerable<T>, XName)

返回经过筛选的元素集合,其中包含源集合中每个节点的上级。Returns a filtered collection of elements that contains the ancestors of every node in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

DescendantNodes<T>(IEnumerable<T>)

返回源集合中每个文档和元素的子代节点的集合。Returns a collection of the descendant nodes of every document and element in the source collection.

Descendants<T>(IEnumerable<T>)

返回元素集合,其中包含源集合中每个元素和文档的子代元素。Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

Descendants<T>(IEnumerable<T>, XName)

返回经过筛选的元素集合,其中包含源集合中每个元素和文档的子代元素。Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

Elements<T>(IEnumerable<T>)

返回源集合中每个元素和文档的子元素的集合。Returns a collection of the child elements of every element and document in the source collection.

Elements<T>(IEnumerable<T>, XName)

返回源集合中经过筛选的每个元素和文档的子元素集合。Returns a filtered collection of the child elements of every element and document in the source collection. 集合中仅包括具有匹配 XName 的元素。Only elements that have a matching XName are included in the collection.

InDocumentOrder<T>(IEnumerable<T>)

返回节点集合(其中包含源集合中的所有节点),并按文档顺序排列。Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>)

返回源集合中每个文档和元素的子节点集合。Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>)

将源集合中的每个节点从其父节点中移除。Removes every node in the source collection from its parent node.

适用于

线程安全性

此类型是线程安全的。This type is thread safe.