ListBox ta Itemsleri Sıralı Göstermek (SortedSet Metodu)
Merhaba arkadaşlar bu makalemizde sortedset metodu ile random ad ve soyadları listbox a sıralı bir şekilde ekleyeceğiz.
Şekil 1
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace sortedlist
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Text = "SortedSet example.. Siralama ornegi.. ";
}
private void button1_Click(object sender, EventArgs e)
{
var sortedSet = new SortedSet<string>();
sortedSet.Add("Bahadir Sahin");
sortedSet.Add("Melissa Parker");
sortedSet.Add("Tommy Paton");
sortedSet.Add("Alice May");
sortedSet.Add("Michael Alon");
sortedSet.Add("Mike Carson");
sortedSet.Add("Tracy Abbot");
sortedSet.Add("Nancy White");
sortedSet.Add("Jack Fox");
sortedSet.Add("Alina Benson");
sortedSet.Add("Joe Eagle");
sortedSet.Add("Johanna Manson");
sortedSet.Add("Emilia Peterson");
foreach (var item in sortedSet)
{
listBox1.Items.Add(item);
}
}
}
}
Bir makalenin daha sonuna geldik. Bir sonraki makalede görüşmek üzere. Bahadır ŞAHİN