언어

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 항목을 가져올 수 없음을 나타냅니다; 이 속성을 사용하면 예외가 발생합니다.

예제

다음 코드 샘플은 "Diagnostic"이라는 이름의 로그 항목이 컬렉션에 있는지 확인하는 메서드를 사용합니다 Contains . 이 메서드는 .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  

샘플 출력:

진단 기능이 포함되어 있나요? True

적용 대상