To get the wordcount of a string in C# and VB.NET you can use the following snippet.
Sample C#
public static int WordCount(string s) { return Regex.Matches(s, @"[\S]+").Count; }
Sample VB.NET
Public Shared Function WordCount(s As String) As Integer Return Regex.Matches(s, "[\S]+").Count End Function
RT @CodeSnippetsNET: How to get the wordcount of a string in .NET http://t.co/rXtKk3pYdA #csharp #vb #dotnet #coding