다음을 통해 공유


ExtendedProperties.Item Property

Returns an ExtendedProperty object from the collection.

네임스페이스: Microsoft.SqlServer.Dts.Runtime
어셈블리: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

구문

‘선언
Public ReadOnly Default Property Item ( _
    index As Object _
) As ExtendedProperty
public ExtendedProperty this [
    Object index
] { get; }
public:
property ExtendedProperty^ default [Object^] {
    ExtendedProperty^ get (Object^ index);
}
/** @property */
public ExtendedProperty get_Item (Object index)

매개 변수

  • index
    The name, description, ID, or index of the ExtendedProperty object to return.

속성 값

An ExtendedProperty object.

주의

If the call to the Contains method returns true, you can access the specified element in the collection by using the syntax ExtendedProperties[index]. However, if the Contains method returns false, this property throws an exception. In C#, this property is the indexer for the ExtendedProperties class.

The following code sample retrieves an item from the collection using two methods. The first method uses the myExtProps[0] syntax to retrieve the entire object located in the first position of the collection and place it in the myExtProp object. You can now retrieve all properties from the myExtProp object as usual. The second method demonstrates how to retrieve a specific property, DataType, from the first object in the collection.

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\90\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\90\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

Sample Output:

The ID of the first item is: {F3B7314E-DB1E-4CCA-A856-2E617A1B3265}

The DataType of the first item is: String

스레드 보안

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

플랫폼

개발 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

대상 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

참고 항목

참조

ExtendedProperties Class
ExtendedProperties Members
Microsoft.SqlServer.Dts.Runtime Namespace