Marshaling


Data passed from .NET to the COM component and the other way around must be converted to the corresponding representation. This mechanism is also known as marshaling. What happens here depends on the data type of the data that is passed: you have to differentiate between blittable and nonblittable data types.

Blittable data types have a common representation with both .NET and COM, and no conversion is needed. Simple data types such as byte, short, int, long, and classes and arrays that only contain these simple data types belong to the blittable data types. Arrays must be 1-dimensional to be blittable.

A conversion is needed with nonblittable data types. The following table lists some of the nonblittable COM data types with their .NET-related data types. Nonblittable types have a higher overhead because of the conversion.

Open table as spreadsheet

COM Data Type

.NET Data Type

SAFEARRAY

Array

VARIANT

Object

BSTR

String

IUnknown*, IDispatch*

Object




Professional C# 2005 with .NET 3.0
Professional C# 2005 with .NET 3.0
ISBN: 470124725
EAN: N/A
Year: 2007
Pages: 427

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net