言語

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 コレクションからアイテムを取得することはできません。このプロパティを使用すると例外が発生します。

以下のコードサンプルは、 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  

出力例:

診断機能が含まれていますか? True

適用対象