Share via


LogEntryInfos.Contains(Object) 메서드

정의

예외를 발생시키지 않고 인덱싱을 사용하여 컬렉션의 항목에 액세스할 수 있는지 여부를 나타냅니다.

public:
 bool Contains(System::Object ^ index);
public bool Contains (object index);
member this.Contains : obj -> bool
Public Function Contains (index As Object) As Boolean

매개 변수

index
Object

컬렉션에서 찾을 LogEntryInfo 개체의 이름, 설명, ID 또는 인덱스입니다.

반환

이름, 설명, ID 또는 인덱스로 컬렉션에 액세스할 수 있는지 여부를 나타내는 부울입니다. true 값은 LogEntryInfos[index] 구문을 사용하여 컬렉션에 액세스할 수 있음을 나타냅니다. false 값은 컬렉션에서 LogEntryInfos 항목을 검색하는 데 인덱싱을 사용할 수 없음을 나타냅니다. 이 속성을 사용하면 예외가 throw됩니다.

예제

다음 코드 샘플에서는 메서드를 Contains 사용하여 이름이 "Diagnostic"인 로그 항목이 컬렉션에 있는지 확인합니다. 메서드는 .를 반환합니다 Boolean.

using System;  
using System.Collections.Generic;  
using System.Text;  
using Microsoft.SqlServer.Dts.Runtime;  

namespace LogEntryInfosTest  
{  
    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);  

            // Get the LogEntryInfos from the package.  
            LogEntryInfos logInfos = pkg.LogEntryInfos;  

            //See if the collection contains a LogEntryInfo named "Diagnostic".  
            Boolean logDiagnostic = logInfos.Contains("Diagnostic");  
            Console.WriteLine("Contains Diagnostic? {0}", logDiagnostic);  

            Console.WriteLine();  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Namespace LogEnTryInfosTest  
    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)   

            ' Get the LogEntryInfos from the package.  
            Dim logInfos As LogEnTryInfos =  pkg.LogEnTryInfos   

            'See if the collection contains a LogEntryInfo named "Diagnostic".  
            Dim logDiagnostic As Boolean =  logInfos.Contains("Diagnostic")   
            Console.WriteLine("Contains Diagnostic? {0}", logDiagnostic)  

            Console.WriteLine()  
        End Sub  
    End Class  
End Namespace  

샘플 출력:

진단이 포함되어 있나요? 참

적용 대상