TaskInfos.Item[Object] プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
TaskInfo をコレクションから取得します。
public:
property Microsoft::SqlServer::Dts::Runtime::TaskInfo ^ default[System::Object ^] { Microsoft::SqlServer::Dts::Runtime::TaskInfo ^ get(System::Object ^ index); };
public Microsoft.SqlServer.Dts.Runtime.TaskInfo this[object index] { get; }
member this.Item(obj) : Microsoft.SqlServer.Dts.Runtime.TaskInfo
Default Public ReadOnly Property Item(index As Object) As TaskInfo
パラメーター
プロパティ値
TaskInfo オブジェクト。
例
次のコード例では、2 つのメソッドを使用して、コレクションから項目を取得します。 最初のメソッドでは、構文を tInfos[0]
使用して、コレクションの最初の位置にあるオブジェクト全体を取得し、オブジェクトに tInfo
配置します。 これによって、tInfo
オブジェクトのすべてのプロパティを通常どおり取得できるようになります。 2 番目のメソッドでは、コレクションの最初のオブジェクトから特定のプロパティを取得します。
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();
TaskInfos tInfos = app.TaskInfos;
//Using the Item method syntax of [x], obtain the first
//entry.
TaskInfo tInfo = tInfos[0];
String nameOfFirstItem = tInfos[0].Name;
//This could also be done using the Name property, as
//demonstrated by this next line of commented code.
//TaskInfo tInfo = tInfos["Execute Package Task"];
//You can also use the ID property.
// TaskInfo tInfo = tInfos["{8FE4A9F8-D077-436B-9B00-C1EEAEFAFE55}"];
//Print the name of the task object located at position [0].
Console.WriteLine("The task ID of the first provider is: {0}", tInfo.ID);
Console.WriteLine("The Name of the first task is: {0}", nameOfFirstItem);
}
}
}
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 tInfos As TaskInfos = app.TaskInfos
'Using the Item method syntax of [x], obtain the first
'entry.
Dim tInfo As TaskInfo = tInfos(0)
Dim nameOfFirstItem As String = tInfos(0).Name
'This could also be done using the Name property, as
'demonstrated by this next line of commented code.
'TaskInfo tInfo = tInfos["Execute Package Task"];
'You can also use the ID property.
' TaskInfo tInfo = tInfos["{8FE4A9F8-D077-436B-9B00-C1EEAEFAFE55}"];
'Print the name of the task object located at position [0].
Console.WriteLine("The task ID of the first provider is: {0}", tInfo.ID)
Console.WriteLine("The Name of the first task is: {0}", nameOfFirstItem)
End Sub
End Class
End Namespace
サンプル出力:
The task ID of the first provider is: {8FE4A9F8-D077-436B-9B00-C1EEAEFAFE55}
The Name of the first task is: Execute Package Task
注釈
メソッドの呼び出しが Contains 返 true
された場合は、構文 TaskInfos[index]
を使用してコレクション内の指定された要素にアクセスできます。 ただし、Contains メソッドの呼び出しで false
が返される場合、このプロパティは例外をスローします。 C# では、このプロパティは TaskInfos クラスのインデクサーです。