Dec082009

.NET Generic kullanılması

Published by Admin at 8:19 PM under Blog

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {

        public class Musteri
        {

            public List<Siprais> Siparisler;
        }

        public class Siparis
        {
            public int SiparisNo;
        }
        //generic bir methoda giden parametlerinde parametrik olmasını sağlar.
        //böylece bir mothodun hem int, hem string, hem float gibi değişik
        //versiyonlarını yazmaya gerek kalmaz.
       
        //not:  her hangi bir tipin sonuna ? koyarakta nullable oldugunu belirler.
        //  int? i = 5;  i = null;
        //  Nullable<int> i = 5;  i = null;
       
        static void Main(string[] args)
        {
            List<String> strArr = new List<string>();
            strArr.add("");

            List<int> intArr = new List<int> ();
            intArr.Add(12);
            Musteri mm = new Musteri();
            mm.Siparisler.Add("Pizza");
            mm.Siparisler.Add("Cola");
            mm.Siparisler.Add("Salata");
            Dictionary<string, Musteri> dicArr = new Dictionary<int, Musteri>();
            dicArr.Add("1",mm);


        }

    }
}



[KickIt] [Dzone] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Tags:

E-mail | Permalink | Trackback | Post RSSRSS comment feed 0 Responses

Dec082009

.NET ve Interface'ler

Published by Admin at 8:17 PM under Blog

.NET ve  Interface'ler



[KickIt] [Dzone] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Tags:

E-mail | Permalink | Trackback | Post RSSRSS comment feed 0 Responses



Locations of visitors to this page