Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardC#boxing and unboxing costSingle-choice MCQ

Given this code on a typical 64-bit CLR, how many distinct boxed objects are allocated on the heap by the loop?

int sum = 0; for (int i = 0; i < 100; i++) { object o = i; // box sum += (int)o; // unbox }