DataTypeInfoEnumerator.Current 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컬렉션의 현재 요소를 가져옵니다.
public:
property System::Object ^ Current { System::Object ^ get(); };
public object Current { get; }
member this.Current : obj
Public ReadOnly Property Current As Object
속성 값
컬렉션의 현재 요소입니다.
구현
예제
다음 코드 샘플은 열거자를 생성한 후, , MoveNext, Reset 메서드를 사용하여 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.
// 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] 플로팅 DT_R4
[1] 이중 정밀도 플로트 DT_R8
[2] 화폐 DT_CY
[3] 날짜 DT_DATE
[4] 불리언 DT_BOOL
[5] 십진수 DT_DECIMAL
[6] 단일 바이트 부호 정수 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
리셋 이후 열거기의 첫 항목:
플로트, DT_R4
설명
열거자가 생성되거나 메서드를 Reset 호출한 후, 속성의 Current 값을 읽기 전에 열거자를 집합의 첫 번째 요소로 진행시키기 위해 메서드를 MoveNext 호출해야 합니다; 그렇지 않으면 는 Current 정의되지 않았으며 예외를 던집니다.
Current는 컬렉션의 끝을 나타내는 반환MoveNext된 false 마지막 호출인 경우 예외를 throw합니다.
Current열거자의 위치를 이동시키지 않으며, 연속적으로 호출 Current 하면 또는 Reset 중 하나가 MoveNext 호출될 때까지 같은 객체를 반환합니다.
컬렉션이 변경되지 않은 상태로 유지되는 한 열거자는 유효한 상태로 유지됩니다. 컬렉션에 요소를 추가, 수정, 삭제하는 등 변경이 이루어지면, 열거기는 무효화되어 복구 불가능해집니다. 만약 컬렉션이 호출 MoveNextCurrent사이에 수정되면, Current 열거기가 무효화되었더라도 해당 집합이 설정된 요소를 반환합니다.