DataTypeInfos.GetEnumerator 메서드

정의

DataTypeInfoEnumerator 컬렉션을 반복할 수 있는 DataTypeInfo를 반환합니다.

public:
 Microsoft::SqlServer::Dts::Runtime::DataTypeInfoEnumerator ^ GetEnumerator();
public Microsoft.SqlServer.Dts.Runtime.DataTypeInfoEnumerator GetEnumerator ();
override this.GetEnumerator : unit -> Microsoft.SqlServer.Dts.Runtime.DataTypeInfoEnumerator
Public Function GetEnumerator () As DataTypeInfoEnumerator

반환

DataTypeInfoEnumerator 컬렉션에 대한 DataTypeInfo입니다.

예제

다음 코드 샘플에서는 메서드를 DataTypeInfoEnumerator 사용하여 GetEnumerator 만든 다음 컬렉션을 반복합니다.

using System;  
using System.Collections.Generic;  
using System.Text;  
using Microsoft.SqlServer.Dts.Runtime;  

namespace DataTypeInfos_GetEnum_Current  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            //Create the DataTypeInfos collection.  
            DataTypeInfos dataInfos = new Application().DataTypeInfos;  

            //Create the enumerator.  
            DataTypeInfoEnumerator myEnumerator = dataInfos.GetEnumerator();  
            Console.WriteLine("The collection contains the following values:");  
            int i = 0;  
            DataTypeInfo dtiObject;  
            while ((myEnumerator.MoveNext()) && (myEnumerator.Current != null))  
            {  
                dtiObject = (DataTypeInfo)myEnumerator.Current;  
                Console.WriteLine("[{0}] {1} {2}", i++, dtiObject.TypeName, dtiObject.TypeEnumName);  
            }  
            // Reset puts the index pointer before the beginning.  
            // Do not retrieve from the collection until MoveNext is called.  
            myEnumerator.Reset();  
            myEnumerator.MoveNext();  
            // Now that the enumerator has been reset, and moved to the  
            // first item in the collection, show the first item.  
            dtiObject = (DataTypeInfo)myEnumerator.Current;  
            Console.WriteLine("The first item in the enumerator after Reset:");  
            Console.WriteLine("{0}, {1}", dtiObject.TypeName, dtiObject.TypeEnumName);  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Namespace DataTypeInfos_GetEnum_Current  
    Class Program  
        Shared  Sub Main(ByVal args() As String)  
            'Create the DataTypeInfos collection.  
            Dim dataInfos As DataTypeInfos =  New Application().DataTypeInfos   

            'Create the Enumerator.  
            Dim myEnumerator As DataTypeInfoEnumerator =  dataInfos.GetEnumerator()   
            Console.WriteLine("The collection contains the following values:")  
            Dim i As Integer =  0   
            Dim dtiObject As DataTypeInfo  
            While (myEnumerator.MoveNext()) &&(myEnumerator.Current <> Nothing)  
                dtiObject = CType(myEnumerator.Current, DataTypeInfo)  
                Console.WriteLine("[{0}] {1} {2}",i = Console.WriteLine("[{0}] {1} {2}",i + 1  
            End While  
            ' Reset puts the index pointer before the beginning.  
            ' Do not retrieve from the collection until MoveNext is called.  
            myEnumerator.Reset()  
            myEnumerator.MoveNext()  
            ' Now that the enumerator has been reset, and moved to the  
            ' first item in the collection, show the first item.  
            dtiObject = CType(myEnumerator.Current, DataTypeInfo)  
            Console.WriteLine("The first item in the enumerator after Reset:")  
            Console.WriteLine("{0}, {1}", dtiObject.TypeName, dtiObject.TypeEnumName)  
        End Sub  
    End Class  
End Namespace  

샘플 출력:

컬렉션에는 다음 값이 포함됩니다.

[0] float DT_R4

[1] 배정밀도 부동 소수 DT_R8

[2] 통화 DT_CY

[3] 날짜 DT_DATE

[4] 부울 DT_BOOL

[5] 10진수 DT_DECIMAL

[6] single-byte 부가 정수 DT_I1

[7] 단일 바이트 부호 없는 정수 DT_UI1

[8] 2 바이트 부가 정수 DT_I2

[9] 2 바이트 부호 없는 정수 DT_UI2

[10] 4 바이트 부가 정수 DT_I4

[11] 4 바이트 부호 없는 정수 DT_UI4

[12] 8 바이트 부가 정수 DT_I8

[13] 8 바이트 부호 없는 정수 DT_UI8

[14] 파일 타임스탬프 DT_FILETIME

[15] 고유 식별자 DT_GUID

[16] 바이트 스트림 DT_BYTES

[17] 문자열 DT_STR

[18] 유니코드 문자열 DT_WSTR

[19] 숫자 DT_NUMERIC

[20] 데이터베이스 날짜 DT_DBDATE

[21] 데이터베이스 시간 DT_DBTIME

[22] 데이터베이스 타임스탬프 DT_DBTIMESTAMP

[23] 이미지 DT_IMAGE

[24] 텍스트 스트림 DT_TEXT

[25] 유니코드 텍스트 스트림 DT_NTEXT

다시 설정 후 열거자의 첫 번째 항목:

float, DT_R4

적용 대상