Contains メソッド

例外がスローされることなく、インデックスを使用してコレクション内の項目にアクセスできるかどうかを示す Boolean を返します。

名前空間:  Microsoft.SqlServer.Dts.Runtime
アセンブリ:  Microsoft.SqlServer.ManagedDTS (Microsoft.SqlServer.ManagedDTS.dll)

構文

'宣言
Public Function Contains ( _
    index As Object _
) As Boolean
'使用
Dim instance As LogProviderInfos
Dim index As Object
Dim returnValue As Boolean

returnValue = instance.Contains(index)
public bool Contains(
    Object index
)
public:
bool Contains(
    Object^ index
)
member Contains : 
        index:Object -> bool 
public function Contains(
    index : Object
) : boolean

パラメーター

戻り値

型: System. . :: . .Boolean
名前、ID、またはインデックスを使用してコレクションにアクセスできるかどうかを示す Boolean です。値が true の場合は、LogProviderInfos[index] 構文を使用してコレクションにアクセスできます。値が false の場合は、インデックスを使用して LogProviderInfos コレクションから項目を取得することができません。このプロパティを使用すると、例外がスローされます。

使用例

次のコード サンプルでは、Contains メソッドを使用して、"SSIS log provider for Text files" という名前のログ プロバイダがコレクションにあるかどうかを調べます。このメソッドは Boolean を返します。

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

namespace LogProvInfoProperties
{
    class Program
    {
        static void Main(string[] args)
        {
        Application app = new Application();
        LogProviderInfos infos = app.LogProviderInfos;

        //See if the collection contains a log provider
        // with the name "SSIS log provider for Text files".
        Boolean logText = infos.Contains("SSIS log provider for Text files");
        Console.WriteLine("Contains Text log provider? {0}", logText);
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
 
Namespace LogProvInfoProperties
    Class Program
        Shared  Sub Main(ByVal args() As String)
        Dim app As Application =  New Application() 
        Dim infos As LogProviderInfos =  app.LogProviderInfos 
 
        'See if the collection contains a log provider
        ' with the name "SSIS log provider for Text files".
        Dim logText As Boolean =  infos.Contains("SSIS log provider for Text files") 
        Console.WriteLine("Contains Text log provider? {0}", logText)
        End Sub
    End Class
End Namespace

サンプルの出力 :

Contains Text log provider?True