반복자 연습 - 제네릭 사용

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace WebApplication1
{
    public class 이윤환
    {
        public 전지현<string>[] Collect;
    }

    public class 전지현<T>
    {
        public T x;
        public 전지현(T x)
        {
            this.x = x;
        }
    }
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            이윤환 a = new 이윤환();
            a.Collect = new 전지현<string>[] { new 전지현<string>("아 "), new 전지현<string>("머라는거야"), new 전지현<string>(" 병신아!!!") };

            IEnumerator ie = a.Collect.GetEnumerator();

            while (ie.MoveNext())
            {
                Response.Write(((전지현<string>)ie.Current).x);
            }

            Response.Write(" 아 짜증나!");
        }
    }
}

by 李君 | 2009/07/21 11:31 | 트랙백 | 덧글(0)

◀ 이전 페이지          다음 페이지 ▶