To count a character in a string in C# and VB.NET you can use the following snippet.
Sample C#
public static Int64 CountChar(this string input, char c) { return input.Count(t => c == t); }
Sample VB.NET
Public Shared Function CountChar(input As String, c As Char) As Int64 Return input.Count(Function(t) c = t) End Function
RT @CodeSnippetsNET: Count a character in a string in .NET http://t.co/APAS23qWuT #csharp #dotnet #vb #programming