다음을 통해 공유


DataTypeInfoEnumerator.MoveNext 메서드

정의

열거자를 컬렉션의 다음 요소로 이동합니다.

public:
 virtual bool MoveNext();
public bool MoveNext ();
abstract member MoveNext : unit -> bool
override this.MoveNext : unit -> bool
Public Function MoveNext () As Boolean

반환

성공 여부를 MoveNext() 나타내는 부울입니다. 열거자가 다음 요소로 성공적으로 진행되었으면 true입니다. 열거자가 컬렉션의 끝을 통과한 경우 false입니다.

구현

예제

다음 코드 예제에서는 열거자를 만든 다음 , MoveNextReset 메서드를 사용하여 Current컬렉션을 탐색합니다.

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  
           // of the collection.  
            // 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  
           ' of the collection.  
            ' 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

적용 대상