共用方式為


marshal_context Class

This class converts data between native and managed environments.

class marshal_context

Remarks

Use the marshal_context class for data conversions that require a context. See Overview of Marshaling in C++ for more information about which conversions require a context and which marshaling file has to be included. The result of marshaling when you use a context is valid only until the marshal_context object is destroyed. To preserve your result, you must copy the data.

The same marshal_context can be used for multiple data conversions. Reusing the context in this manner will not affect the results from previous marshaling calls.

Requirements

Header file: <msclr\marshal.h>, <msclr\marshal_windows.h>, <msclr\marshal_cppstd.h>, or <msclr\marshal_atl.h>

Namespace: msclr::interop

See Also

Reference

marshal_as

Concepts

Overview of Marshaling in C++