Word Count
Below is the complete code for the Word Count Try It Out! problem.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ExtensionMethods
{
/// <summary>
/// A place to put extension methods for the string type.
/// </summary>
public static class StringExtensions
{
/// <summary>
/// Counts the number of words in a string and returns it.
/// </summary>
public static int WordCount(this string text)
{
return text.Split(' ').Length;
}
}
}