Ниже продемонстрирован код программы, которая подсчитывает количество слов в строке.
static void Main(string[] args) { string sentence; Console.Write("Enter String : "); sentence = Console.ReadLine(); string[] words = sentence.Split(' '); Console.WriteLine("Count of words :"+words.Length); Console.ReadKey(); }