I adjusted this more and came up with the following code and I think my only problem is how I instruct it to read from textbox1 and output into textbox2 with the sorting instructions. I've been fighting this for days off and on if someone could help me out, thanks!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
System.Collections.Generic.Dictionary<string, int> myDict = new Dictionary<string, int>();
myDict.Add("one", 1);
myDict.Add("four", 4);
myDict.Add("two", 2);
myDict.Add("three", 3);
var sortedDict = (from entry in myDict orderby entry.Value ascending select entry);
string[] items = textBox1.Text.Split(Environment.NewLine.ToCharArray());
Array.Sort(items, new ??? ());
textBox2.Text = String.Join(Environment.NewLine, items);
}
}
}