fork(1) download
  1. using System;
  2. using System.Globalization;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8.  
  9. string[] values = new string[] { "1,000", "1,4500", "1" };
  10.  
  11. foreach (var value in values)
  12. {
  13. if (decimal.TryParse(value,NumberStyles.Integer,CultureInfo.InvariantCulture, out var eval))
  14. {
  15. bool isWholeNumber = Math.Floor(decimal.Parse(value)) == decimal.Parse(value);
  16. Console.WriteLine("The value " + value + " is integer " + isWholeNumber);
  17. }
  18. }
  19. }
  20. }
Success #stdin #stdout 0.02s 22600KB
stdin
Standard input is empty
stdout
The value 1 is integer True