DBProviderInfos.Contains(Object) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컬렉션 내 항목이 예외를 던지지 않고 인덱싱을 통해 접근할 수 있는지 나타내는 불리언을 반환합니다.
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
객체의 이름, 설명 또는 인덱스를 포함하는 객체입니다.
반품
컬렉션에 이름, 설명, 또는 인덱스 매개변수로 전달된 인덱스로 접근할 수 있는지 나타내는 불리언입니다. true의 값은 해당 컬렉션에 DBProviderInfos[index] 구문을 사용해 접근할 수 있음을 나타냅니다. false 값은 인덱스를 사용해 컬렉션에서 DBProviderInfos 항목을 검색할 수 없음을 나타냅니다.
예제
다음 코드 샘플은 컬렉션 내 첫 번째 항목 이름을 출력하는 메서드를 사용합니다 Contains . 이 메서드는 .Boolean
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace DBProvInfos_GetEnum
{
class Program
{
static void Main(string[] args)
{
Application app = new Application();
DBProviderInfos dbprovInfos = app.DBProviderInfos;
// Search for the MediaCatalogDB provider in the collection
if (dbprovInfos.Contains(0))
Console.WriteLine("The collection contains {0} provider", dbprovInfos[0].Name);
else
Console.WriteLine("The collection does not contain {0} provider", dbprovInfos[0].Name);
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace DBProvInfos_GetEnum
Class Program
Shared Sub Main(ByVal args() As String)
Dim app As Application = New Application()
Dim dbprovInfos As DBProviderInfos = app.DBProviderInfos
' Search for the MediaCatalogDB provider in the collection
If dbprovInfos.Contains(0) Then
Console.WriteLine("The collection contains {0} provider", dbprovInfos(0).Name)
Else
Console.WriteLine("The collection does not contain {0} provider", dbprovInfos(0).Name)
End If
End Sub
End Class
End Namespace
샘플 출력:
컬렉션에는 MediaCatalogDB OLE DB 제공자 제공자가 포함되어 있습니다