// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; namespace E { public class Program { public static void Test(string s) { int iv; double xv; if(int.TryParse(s, out iv)) { Console.WriteLine(s + " is an integer number"); } else if(double.TryParse(s, out xv)) { Console.WriteLine(s + " is a decimal number"); } else { Console.WriteLine(s + " is not a number"); } } public static void Main(string[] args) { Test("123"); Test("123,456"); Test("ABC"); } } }