52
1
using System;
2
3
public class Program
4
{
5
public static void Main()
6
{
7
TestCastingFromObjectToDouble();
8
}
9
10
public static void TestCastingFromObjectToDouble()
11
{
12
13
Log("The purpose of this test is to show how an object holding an int value can be cast to a double.");
14
Log();
15
16
int int_a = 5;
17
Log("The original int we're working with is int_a = " + int_a);
18
19
double dbl_intCastedToDouble = (double)int_a;
20
Log("We can easily cast this int to a double: " + dbl_intCastedToDouble);
21
Log();
22
23
object obj_intCastedToObject = (object)int_a;
24
Log("We can easily also cast an int to an object: " + obj_intCastedToObject);
Cached Result