Tablets.TabletsEnumerator.Current 属性

获取枚举数指向的 Tablets 集合中的 Tablet 对象。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public ReadOnly Property Current As Tablet
用法
Dim instance As Tablets..::.TabletsEnumerator
Dim value As Tablet

value = instance.Current
public Tablet Current { get; }
public:
property Tablet^ Current {
    Tablet^ get ();
}
/** @property */
public Tablet get_Current()
public function get Current () : Tablet

属性值

类型:Microsoft.Ink.Tablet
枚举数指向的 Tablets 集合中的 Tablet 对象。

备注

创建 Tablets.TabletsEnumerator 枚举数或调用 Reset 方法后,必须先通过调用 MoveNext 方法将枚举数前移到集合的第一个元素,然后才能读取 Current 属性的值;否则 Current 属性是未定义的。

如果上次调用 MoveNext 方法返回的是 false,则 Current 属性会引发异常。如果上次调用 MoveNext 方法返回的是 false,则枚举数已到达 Tablets 集合的末尾。

Current 属性不移动枚举数的位置。连续调用 Current 属性将返回相同的对象,直到调用 MoveNextReset 方法为止。

只要该集合保持不变,枚举数也就保持有效。如果对该集合进行了更改(例如添加、修改或删除元素),则枚举数将失效且不可恢复。下次调用 MoveNextReset 方法将引发 InvalidOperationException 异常。如果在调用 MoveNext 方法和调用 Current 属性之间修改集合,那么即使枚举数已经无效,Current 属性也将返回它所设置成的元素。

示例

此示例使用 Tablets 集合的 IEnumerator 来循环访问 Tablets 集合 allTablets,并在 ListBox 对象 listBoxTablets 中填入附加在系统上的每个 Tablet 设备的名称。

' Calling the constructor automatically fills the 
' Tablets collection with the available Tablet objects.
Dim allTablets As Tablets = New Tablets()

' clear the list box
Me.listBoxTablets.Items.Clear()

' populate the list box with the name of each tablet
' version using GetEnumerator()
Dim theTabletsEnumerator As IEnumerator = allTablets.GetEnumerator()
While (theTabletsEnumerator.MoveNext())
    Dim T As Tablet = theTabletsEnumerator.Current
    Me.listBoxTablets.Items.Add(T.Name)
End While
// Calling the constructor automatically fills the 
// Tablets collection with the available Tablet objects.
Tablets allTablets = new Tablets();

// clear the list box
this.listBoxTablets.Items.Clear();

// populate the list box with the name of each tablet
// version using GetEnumerator()
IEnumerator theTabletsEnumerator = allTablets.GetEnumerator();
while (theTabletsEnumerator.MoveNext())
{
    Tablet T = (Tablet)theTabletsEnumerator.Current;
    this.listBoxTablets.Items.Add(T.Name);
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

Tablets.TabletsEnumerator 类

Tablets.TabletsEnumerator 成员

Microsoft.Ink 命名空间

Tablets

Tablet

Tablets.TabletsEnumerator.MoveNext

Tablets.TabletsEnumerator.Reset

其他资源

T:System.Collections.IEnumerator Interface