Marshal.StructureToPtr without boxing
问题 Is there a way to marshal a structure (possibly stored in a TypedReference ) to unmanaged memory without actually boxing it? The type of the structure isn't known at runtime, so I can't use the generic overload of StructureToPtr (.NET 4.5.1). I can get a MethodInfo of the StructureToPtr overload, but there doesn't seem to be a way to invoke it passing a generic reference or a TypedReference . Edit: The generic StructureToPtr still boxes the structure, so trying to invoke it is useless. 回答1: I