Wrappers for raw data located in unmanaged memory.
Using the Data type will only place a small object in managed memory, keeping the actual data in unmanaged memory. A proxy class (DataWrapper) is used to safely allow multiple references to the same block of unmanaged memory. When the DataWrapper object is destroyed (either manually or by the garbage collector when there are no remaining Data references), the unmanaged memory is deallocated.
This has the following advantage over using managed memory:
On the other hand, using Data has the following disadvantages:
Wrapper for data located in external memory, to prevent faux references. Represents a slice of data, which may or may not be in unmanaged memory. Data in unmanaged memory is bound to a DataWrapper class instance.