I\'m looking for a way to write code that tests whether a value is boxed.
My preliminary investigations indicate that .NET goes out of its way to conceal the fact,
I think actually the question is kind of misstated. Isn't the question actually, "How can I tell if an object is a box for another type?"
With reference to Allon's comment, if you have an object of type Object and the object is a primitive value type, it's a box. I'm not certain this is 100% correct, but (similar to Allon's implementation):
// Assume there is some object o.
bool isBoxed = o.GetType().IsPrimitive;