This appears to be a very old question, but I'd like to add one more use-case: when you have a struct and want to set its variable through reflection, you would always operate on the boxed value and never change the original. This is useless:
TestFields fields = new TestFields { MaxValue = 1234 };
FieldInfo info = typeof(TestFields).GetField("MaxValue");
info.SetValue(fields, 4096);
// result: fields.MaxValue is still 1234!!
This can be remedied with implied boxing, but then you loose type safety. Instead, you can fix this with a TypedParameter
:
TestFields fields = new TestFields { MaxValue = 1234 };
FieldInfo info = fields.GetType().GetField("MaxValue");
TypedReference reference = __makeref(fields);
info.SetValueDirect(reference, 4096);
// result: fields.MaxValue is now indeed 4096!!