
C# Programlama – Hash Table Kullanımı
Ekim 30, 2022
C# Programlama – Stack Kullanımı
Ekim 30, 2022C# Programlama - Sorted List Kullanımı
Sorted List Kullanımı Örnekleri:
using System;
using System.Collections;
namespace SortedListKullanimi
{
class Program
{
static void Main(string[] args)
{
SortedList slOne = new SortedList();
slOne.Add(01, "SUNDAY");
slOne.Add(02, "MONDAY");
slOne.Add(03, "TUESDAY");
slOne.Add(04, "WEDNESDAY");
slOne.Add(05, "THURSDAY");
slOne.Add(06, "FRİDAY");
slOne.Add(07, "SATURDAY");
// Burada DictionaryEntry sınıfından bir nesne dönecek
foreach (DictionaryEntry item in slOne)
{
Console.WriteLine(String.Format("{0} : {1}", item.Key, item.Value));
}
Console.ReadKey();
// Hashtable benzer hatta birebir aynıdır. En büyük özelliği Verilen elemanları sırasıya tutar. Hashtable kendisine
// özgü bir hash algoritmasıyla verileri tutmakta. Sortedlistte ise böyle bir durum olmamakla birlikte verilen
// datalar sıralı bir biçimde saklanmaktadır.
// ------------------------------------------------------
SortedList slTwo = new SortedList();
slTwo.Add(1, "Galatasaray");
slTwo.Add(2, "Fenerbahçe");
slTwo.Add(3, "Başakşehir");
slTwo.Add(4, "Beşiktaş");
foreach (DictionaryEntry item in slTwo)
{
Console.WriteLine(string.Format("{0} {1}", item.Key, item.Value));
}
Console.ReadKey();
}
}
}