PipelineComponentInfos.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
要在集合中找到的 PipelineComponentInfo 对象的名称、标识、ID 或索引。
返回
一个布尔值,指示是否可以按名称、标识、ID 或索引访问集合。 true 值指示可以使用语法 PipelineComponentInfos [index] 访问集合。 false 值指示索引不能用于从 PipelineComponentInfos 集合中检索项;使用此属性引发异常。
示例
下面的代码示例使用 Contains 方法来确定名称为“Merge”的管道组件是否在集合中。 该方法返回一个 Boolean
.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace TaskInfos_Item
{
class Program
{
static void Main(string[] args)
{
Application app = new Application();
PipelineComponentInfos pInfos = app.PipelineComponentInfos;
// Search the collection by name.
if (pInfos.Contains("Merge"))
Console.WriteLine("The collection contains {0} pipeline component", pInfos[0].Name);
else
Console.WriteLine("The collection does not contain {0} pipeline component", pInfos[0].Name);
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace TaskInfos_Item
Class Program
Shared Sub Main(ByVal args() As String)
Dim app As Application = New Application()
Dim pInfos As PipelineComponentInfos = app.PipelineComponentInfos
' Search the collection by name.
If pInfos.Contains("Merge") Then
Console.WriteLine("The collection contains {0} pipeline component", pInfos(0).Name)
Else
Console.WriteLine("The collection does not contain {0} pipeline component", pInfos(0).Name)
End If
End Sub
End Class
End Namespace
示例输出:
该集合包含合并管道组件