🙂 İNSANLARIN EN HAYIRLISI INSANLARA FAYDALI OLANDIR 🙂

Burak Kemal KOYUNCU / C# / Liste oluşturma

1-) C# - C# - Liste oluşturma

 class MyList<T>

    {

        T[] items;

        //constructor

        public MyList()

        {

            items = new T[0];

        }

        public void Add(T item)

        {

            T[] tempArray = items;

            items = new T[items.Length + 1];

            for (int i = 0; i < tempArray.Length; i++)

            {

                items[i] = tempArray[i];

            }

            items[items.Length - 1] = item;

        }

        public T[] Items

        {

            get { return items; }

        }

 

    }

 

 

 class Program

    {

        static void Main(string[] args)

        {

            MyList<string> isimler = new MyList<string>();

            isimler.Add("Engin");

 

            foreach (var item in isimler.Items)

            {

                Console.WriteLine(item);

            }

        }

    }

 

 2021 Ocak 21 Perşembe
 438