public static void Main()
const int count = 1000000;
var stopwatch = System.Diagnostics.Stopwatch.StartNew();
for (var i = 0; i < count; i++)
var isMatch = System.Text.RegularExpressions.Regex.IsMatch(str, @"^\d{10}$");
Console.WriteLine("Regex: " + stopwatch.ElapsedMilliseconds);
for (var i = 0; i < count; i++)
&& str.All(c => '0' <= c && c <= '9');
Console.WriteLine("LINQ: " + stopwatch.ElapsedMilliseconds);