In the following code ...
int i=5;
object o = 5;
Console.WriteLine(o);
I have three questions:
1) What additional / useful functions will be obtained 5that are in the variable o, which do not have 5, represented by the variable i?
2) If some code expects a value type, we can simply pass it int i, but if it expects a reference type, it is probably not interested in 5 placed in the field oanyway. So, when are box conversions explicitly used in code?
3) How did you Console.WriteLine(o)print 5 instead of System.Object?
source
share