1 2 3 4 5 6 7 8 9 10
using System.Text.RegularExpressions; public static class Extensions { public static bool IsPositiveInteger(this string s) { Regex regex = new Regex(@"^\d*$"); return regex.IsMatch(s); } }