System.Runtime.InteropServices.BStrWrapper Class

Marshals data of type VT_BSTR from managed to unmanaged code. This class cannot be inherited.

See Also: BStrWrapper Members


public sealed class BStrWrapper


The System.Runtime.InteropServices.BStrWrapper class controls how the wrapped object is marshaled when passed as VARIANT. You can wrap a string object in a System.Runtime.InteropServices.BStrWrapper object to marshal it as VT_BSTR. System.Runtime.InteropServices.BStrWrapper is useful when passing a null string to unmanaged code. Without System.Runtime.InteropServices.BStrWrapper, a null string is passed as VT_EMPTY; however, wrapping the string with System.Runtime.InteropServices.BStrWrapper ensures that the null string is passed as VT_BSTR.


Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions:,
Since: .NET 2.0