---
title: "SortedList in C#"  
description: "SortedList sl = new SortedList();  //creating sorted list.  private voidbtnAdd_Click(object sender, EventArgs e)  {  if(txtValue.Text != \"\" &&txtKey.T"  
author: "Uttam Misra"  
published: 2010-11-01  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/39/sortedlist-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# SortedList in C#

```
SortedList sl = new SortedList();//creating sorted list.
private voidbtnAdd_Click(object sender, EventArgs e)
{
if(txtValue.Text != "" &&txtKey.Text != "")
      {
            sl.Add(txtKey.Text, txtValue.Text);//adding key and value to sortedlist.
            txtKey.Text= "";
           txtValue.Text = "";
      }
      else
            MessageBox.Show("Text Box Empty");
}
```

---

Original Source: https://www.mindstick.com/blog/39/sortedlist-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
