ExecutableEnumerator.Current Özelliği
Geçerli öğe alır koleksiyon.
Ad Alanı: Microsoft.SqlServer.Dts.Runtime
Derleme: Microsoft.SqlServer.ManagedDTS (Microsoft.SqlServer.ManagedDTS içinde.dll)
Sözdizimi
'Bildirim
Public ReadOnly Property Current As Executable
Get
'Kullanım
Dim instance As ExecutableEnumerator
Dim value As Executable
value = instance.Current
public Executable Current { get; }
public:
property Executable^ Current {
Executable^ get ();
}
member Current : Executable
function get Current () : Executable
Özellik Değeri
Tür: Microsoft.SqlServer.Dts.Runtime.Executable
Geçerli öğe koleksiyon.
Açıklamalar
Bir Numaralandırıcı oluşturulduktan sonra veya çağrısı yapıldıktan sonra Reset yöntem, MoveNext yönteminin çağrıldığı, numaralayıcı ilk öğe için ilerlemek için koleksiyon numaralayıcı değeri okuyabilmek için öncelikle Current özellik; Aksi takdirde, Current tanımsız ve atar bir özel durum.
CurrentSon çağrısı, aynı zamanda bir istisna atar MoveNext döndürülen yanlış, sonuna kadar gösterir koleksiyon.
CurrentNumaralayıcı ve art arda çağrılar konumunu taşımak Current dönmek kadar ya da ayný nesneye MoveNext veya sıfırlama denir.
Bir Numaralandırıcı geçerli kalır sürece koleksiyon değişmeden kalır.Koleksiyon, ekleme, değiştirme veya öğeleri silme gibi değişiklikler yapılırsa numaralayıcı geçersiz kılınır ve Düzeltilemeyen olur; Böylece, sonraki çağrı MoveNext veya Reset bir istisna atar.Ancak, yapılan çağrılar arasında koleksiyon değiştirilirse MoveNext ve Current, Current Bu öğeyi döndürür küme kadar numaralayıcı getirildi bile.
Örnekler
Aşağıdaki kod örneği, paket Ekle toplu görev ekler, alır Executables koleksiyon, bir sýralayýcý oluşturur ve ad kullanarak gösterir TaskHost.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace Executables_API
{
class Program
{
static void Main(string[] args)
{
// Create the package and add the BulkInsertTask.
Package pkg = new Package();
Executable exec = pkg.Executables.Add("STOCK:BulkInsertTask");
// Obtain the collection.
Executables pgkExecs = pkg.Executables;
//Create the Enumerator.
ExecutableEnumerator myEnumerator = pgkExecs.GetEnumerator();
Console.WriteLine("The collection contains the following values:");
int i = 0;
Executable myExec;
TaskHost myTH;
while ((myEnumerator.MoveNext()) && (myEnumerator.Current != null))
{
myExec = (Executable)myEnumerator.Current;
myTH = (TaskHost)myExec;
Console.WriteLine("[{0}] {1}", i++, myTH.Name);
}
// Reset puts the index pointer before the beginning.
// Do not retrieve from the collection until MoveNext is called.
myEnumerator.Reset();
myEnumerator.MoveNext();
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace Executables_API
Class Program
Shared Sub Main(ByVal args() As String)
' Create the package and add the BulkInsertTask.
Dim pkg As Package = New Package()
Dim exec As Executable = pkg.Executables.Add("STOCK:BulkInsertTask")
' Obtain the collection.
Dim pgkExecs As Executables = pkg.Executables
'Create the Enumerator.
Dim myEnumerator As ExecutableEnumerator = pgkExecs.GetEnumerator()
Console.WriteLine("The collection contains the following values:")
Dim i As Integer = 0
Dim myExec As Executable
Dim myTH As TaskHost
While (myEnumerator.MoveNext()) &&(myEnumerator.Current <> Nothing)
myExec = CType(myEnumerator.Current, Executable)
myTH = CType(myExec, TaskHost)
Console.WriteLine("[{0}] {1}",i = Console.WriteLine("[{0}] {1}",i + 1
End While
' Reset puts the index pointer before the beginning.
' Do not retrieve from the collection until MoveNext is called.
myEnumerator.Reset()
myEnumerator.MoveNext()
End Sub
End Class
End Namespace
Örnek Çıktı:
Koleksiyon aşağıdaki değerleri içerir:
[0] C435F0C7-97E8-4DCC-A0FF-C6C805D9F64E