Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Casting Integer in C#

The following code explains the simple casting of integer.

  1. using System;
  2. using System.Text;
  3.  
  4. namespace forgetCode
  5. {
  6.  
  7. class program
  8. {
  9. public static void Main()
  10. {
  11. int value = (int)1.5; // Cast 1.
  12. Console.WriteLine(value);
  13.  
  14. }
  15. }
  16. }


Output:

1