.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Collections.Generic;

string [] mots = new []
{
   "bonjour", "coucou", "allo", "coucou", "yo", "bonjour", "coucou"
};
foreach(var (Mot, Nb) in CompterOccurrences(mots))
   Console.WriteLine($"Le mot {Mot} apparaît {Nb} fois");

static (string Nom, int Nb)[] CompterOccurrences(string [] mots)
{
   Dictionary<string, int> dictio = new ();
   foreach(string mot in mots)
      if(dictio.ContainsKey(mot))
         dictio[mot]++;
      else
         dictio.Add(mot, 1);
   (string, int) [] tab = new (string, int)[dictio.Count];
   int i = 0;
   foreach(var p in dictio)
      tab[i++] = (p.Key, p.Value);
   return tab;
}
;