Share via


BlockCollection 类

定义

表示 Block 元素的集合。

public ref class BlockCollection sealed : IIterable<Block ^>, IVector<Block ^>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class BlockCollection final : IIterable<Block>, IVector<Block>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class BlockCollection final : IIterable<Block>, IVector<Block>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class BlockCollection : IEnumerable<Block>, IList<Block>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class BlockCollection : IEnumerable<Block>, IList<Block>
Public NotInheritable Class BlockCollection
Implements IEnumerable(Of Block), IList(Of Block)
继承
Object Platform::Object IInspectable BlockCollection
属性
实现

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

注解

枚举 C# 或 Microsoft Visual Basic 中的集合

可以在 C# 或 Microsoft Visual Basic 中循环访问 BlockCollection 对象。 在许多情况下,例如使用 foreach 语法,编译器会为你执行此强制转换,你无需显式强制转换为 IEnumerable<Block> 。 如果需要显式强制转换(例如,如果要调用 GetEnumerator),请使用 Block 约束将集合对象强制转换为 IEnumerable<T>

属性

Size

获取集合的大小 (计数) 。

方法

Append(Block)

将新项添加到集合。

Clear()

从集合中移除所有项。

First()

返回迭代器,以便对集合中的项进行迭代。

GetAt(UInt32)

返回位于指定索引处的项。

GetMany(UInt32, Block[])

通过迭代器在一次传递中检索多个元素。

GetView()

获取集合中的不可变视图。

IndexOf(Block, UInt32)

检索指定项的索引。

InsertAt(UInt32, Block)

在指定的索引处插入指定的项。

RemoveAt(UInt32)

删除指定索引处的项。

RemoveAtEnd()

删除集合中的最后一项。

ReplaceAll(Block[])

最初清除集合,然后将提供的数组作为新项插入。

SetAt(UInt32, Block)

将指定索引处的值设置为指定的 Block 值。

适用于

另请参阅