C# 기초 강의실

시삽: 레드플러스 님 
게시판 이동:
 제목 : IEnumerator 인터페이스 : foreach문으로 출력하는 방법과 동일한 방식
글번호: 347
작성자: 레드플러스
작성일: 2012/09/19 오후 9:51:00
조회수: 3069
파일: IEnumeratorDemo.png (36 KB) / 전송수: 1535
IEnumeratorDemo.png
using System;
using System.Collections;

namespace IEnumeratorDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] names = {"데브렉", "닷넷코리아", "비주얼아카데미" };

            // foreach문으로 출력하는 방법과 동일한 방식을 IEnumerator 방식으로 출력
            IEnumerator enumerator = names.GetEnumerator();
            while (enumerator.MoveNext())
            {
                Console.WriteLine(enumerator.Current);
            }
        }
    }
}
 
이전 글   다음 글 삭제 수정 답변 글쓰기 리스트

(댓글을 남기려면 로그인이 필요합니다.)

관련 아티클 리스트
  제       목 파일 작성자 작성일 조회
이전글 컬렉션 - 레드플러스 2012-09-19 2661
현재글 IEnumerator 인터페이스 : foreach문으로 출력하는 방법과 동일한 방식 IEnumeratorDemo.png(36 KB) 레드플러스 2012-09-19 3069
다음글 20. 유틸리티 클래스 - 레드플러스 2012-07-19 2639
 
손님 사용자 Anonymous (손님)
로그인 Home