ExtendedProperties.Item[Object] プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
コレクションから ExtendedProperty オブジェクトを取得します。
public:
property Microsoft::SqlServer::Dts::Runtime::ExtendedProperty ^ default[System::Object ^] { Microsoft::SqlServer::Dts::Runtime::ExtendedProperty ^ get(System::Object ^ index); };
public Microsoft.SqlServer.Dts.Runtime.ExtendedProperty this[object index] { get; }
member this.Item(obj) : Microsoft.SqlServer.Dts.Runtime.ExtendedProperty
Default Public ReadOnly Property Item(index As Object) As ExtendedProperty
パラメーター
- index
- Object
返すべき ExtendedProperty オブジェクトの名前、説明、ID、インデックス。
プロパティ値
コレクションからの ExtendedProperty オブジェクト。
例
以下のコードサンプルは、コレクションからアイテムを2つの方法で取得します。 最初の方法は myExtProps[0] 構文を用いて、コレクションの最初の位置にあるオブジェクト全体を取得し、 myExtProp オブジェクトに配置します。 通常通り myExtProp オブジェクトからすべてのプロパティを取得することができます。 2つ目の方法は、コレクションの最初のオブジェクトから特定の性質 DataTypeを取得する方法を示しています。
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace ExtendedProperties_Testing
{
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 extended properties collection from the package.
ExtendedProperties myExtProps = pkg.ExtendedProperties;
//Using the Item method syntax of [x], obtain the
// entire first entry, and then just the name.
ExtendedProperty myExtProp = myExtProps[0];
String dataTypeOfFirstItem = myExtProps[0].DataType.ToString();
//Print the name of the extended property
//located at position [0].
Console.WriteLine("The ID of the first item is: {0}", myExtProp.ID);
Console.WriteLine("The DataType of the first item is: {0}", dataTypeOfFirstItem);
Console.WriteLine();
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace ExtendedProperties_Testing
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 extended properties collection from the package.
Dim myExtProps As ExtendedProperties = pkg.ExtendedProperties
'Using the Item method syntax of [x], obtain the
' entire first entry, and then just the name.
Dim myExtProp As ExtendedProperty = myExtProps(0)
Dim dataTypeOfFirstItem As String = myExtProps(0).DataType.ToString()
'Print the name of the extended property
'located at position [0].
Console.WriteLine("The ID of the first item is: {0}", myExtProp.ID)
Console.WriteLine("The DataType of the first item is: {0}", dataTypeOfFirstItem)
Console.WriteLine()
End Sub
End Class
End Namespace
出力例:
最初の項目のIDは以下の通りです:{F3B7314E-DB1E-4CCA-A856-2E617A1B3265}
最初の項目のデータ型は:Stringです
注釈
Containsメソッドの呼び出しがtrue返された場合、構文ExtendedProperties[index]を使ってコレクション内の指定された要素にアクセスできます。 しかし、 Contains メソッドが falseを返すと、この性質は例外を投げ出します。 C# では、このプロパティは ExtendedProperties クラスのインデクサーです。