LogProviders.Item[Object] Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
LogProvider Mendapatkan objek dari koleksi.
public:
property Microsoft::SqlServer::Dts::Runtime::LogProvider ^ default[System::Object ^] { Microsoft::SqlServer::Dts::Runtime::LogProvider ^ get(System::Object ^ index); };
public Microsoft.SqlServer.Dts.Runtime.LogProvider this[object index] { get; }
member this.Item(obj) : Microsoft.SqlServer.Dts.Runtime.LogProvider
Default Public ReadOnly Property Item(index As Object) As LogProvider
Parameter
- index
- Object
Nama, deskripsi, ID, atau indeks objek yang akan dikembalikan dari koleksi.
Nilai Properti
Objek LogProvider dari koleksi.
Contoh
Contoh kode berikut mengambil item dari koleksi dengan menggunakan dua metode. Metode pertama menggunakan logProvs[0] sintaks untuk mengambil seluruh objek yang terletak di posisi pertama koleksi dan menempatkannya di logProv objek . Anda sekarang dapat mengambil semua properti dari logProv objek seperti biasa. Metode kedua menunjukkan cara mengambil properti tertentu dari objek pertama dalam koleksi.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace LogProviders_Tests
{
class Program
{
static void Main(string[] args)
{
// The package is one of the SSIS Samples.
string mySample = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx";
// Create the Application, and load the sample.
Application app = new Application();
Package pkg = app.LoadPackage(mySample, null);
LogProviders logProvs = pkg.LogProviders;
//Using the Item method syntax of [x], obtain the
// first entry and a name.
LogProvider logProv = logProvs[0];
String nameOfFirstItem = logProvs[0].Name;
//Print the name of the log provider object
// located at position [0].
Console.WriteLine("The ID of the first connection info is: {0}", logProv.ID);
Console.WriteLine("The Name of the first connection info is: {0}", nameOfFirstItem);
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace LogProviders_Tests
Class Program
Shared Sub Main(ByVal args() As String)
' The package is one of the SSIS Samples.
Dim mySample As String = "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx"
' Create the Application, and load the sample.
Dim app As Application = New Application()
Dim pkg As Package = app.LoadPackage(mySample,Nothing)
Dim logProvs As LogProviders = pkg.LogProviders
'Using the Item method syntax of [x], obtain the
' first entry and a name.
Dim logProv As LogProvider = logProvs(0)
Dim nameOfFirstItem As String = logProvs(0).Name
'Print the name of the log provider object
' located at position [0].
Console.WriteLine("The ID of the first connection info is: {0}", logProv.ID)
Console.WriteLine("The Name of the first connection info is: {0}", nameOfFirstItem)
End Sub
End Class
End Namespace
Contoh Output:
ID info koneksi pertama adalah: {1E107E39-DB79-4F02-B8A7-61D88F2DEF63}
Nama info koneksi pertama adalah: Penyedia log SSIS untuk file Teks
Keterangan
Jika panggilan ke Contains metode mengembalikan true, Anda dapat mengakses elemen yang ditentukan dalam koleksi dengan menggunakan sintaks LogProviders[index]. Jika mengembalikan Containsfalse, properti ini memberikan pengecualian. Di C#, properti ini adalah pengindeks LogProviders untuk kelas .