Feedback

Buchstaben zählen

Sprache: C#

kleines Snippet, das die Anzahl der vorkommenden Buchstaben zählt 1. neues Form anlegen 2. textbox und datagridview hinzufügen 3. doppelklick auf die textbox, und code wie unten einfügen
 public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            dataGridView1.DataSource = textBox1.Text.GroupBy(c => c).Select(g => new { c = g.Key, count = g.Count() }).ToArray();
        }
    }
 public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            dataGridView1.DataSource = textBox1.Text.GroupBy(c => c).Select(g => new { c = g.Key, count = g.Count() }).ToArray();
        }
    }