Introducing Radical.sh

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

Implicit Casting in C#

The following code explains the casting between INT and object types:

  1. using System;
  2. using System.Text;
  3.  
  4. namespace forgetCode
  5. {
  6.  
  7. class program
  8. {
  9. public static void Main()
  10. {
  11. // Assign an integer and then cast it to an object implictly.
  12. int value1 = 100;
  13. object value2 = value1;
  14. Console.WriteLine(value2);
  15.  
  16. }
  17. }
  18. }


Output:
100