ErrorWrapper Class
Assembly: mscorlib (in mscorlib.dll)
'Declaration <SerializableAttribute> _ <ComVisibleAttribute(True)> _ Public NotInheritable Class ErrorWrapper 'Usage Dim instance As ErrorWrapper
/** @attribute SerializableAttribute() */ /** @attribute ComVisibleAttribute(true) */ public final class ErrorWrapper
SerializableAttribute ComVisibleAttribute(true) public final class ErrorWrapper
Not applicable.
By default, Object type arguments are marshaled as a VARIANT type, where the object type determines the VARTYPE value of the VARIANT. For example, an integer type passed as Object is marshaled as a VT_I4. In order to marshal the integer as a variant of type VT_ERROR, the integer can be wrapped in the ErrorWrapper before making the method call.
Note that ErrorWrapper objects are not marshaled as type VT_ERROR after they are passed back from COM. Lone parameters are marshaled back from COM as type VT_I4, while arrays are marshaled back from COM as type VT_UI4.
For more information on VT_ERROR, please see the existing documentation for VARENUM::VT_ERROR in the MSDN library.
The following code example first demonstrates a lone Int32 object marshaled back from COM as an Int32 object. It then demonstrates an Int32 array marshaled back from COM as a UInt32 array.
// Scenario 1: // Pass a lone parameter. Int32 x = 3; Object o = new ErrorWrapper(x); // Pass 'o' to COM. // On the return trip, 'o' has been unwrapped and is still an Int32 object. Int32 y = (Int32)o; Scenario 2: // Pass an array parameter. Int32[] arr = new Int32[3]; Object o = new ErrorWrapper(arr); // Pass 'o' to COM. // On the return trip, 'o' has been unwrapped and is now a UInt32[] array. UInt32[ ] arr2 = (UInt32[])o;
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.