// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Collections.Generic; namespace E { public class Program { public static void Main(string[] args) { string text = "a bb ccc"; HashSet words1 = new HashSet(); foreach (string word in text.Split(' ')) { words1.Add(word); } Console.WriteLine(words1.Count); HashSet words2 = new HashSet(text.Split(' ')); Console.WriteLine(words2.Count); } } }