This class contains methods that either cannot be expressed in C#, or which require writing unsafe code. Callers of these methods need to use them extremely carefully as incorrect use could cause GC-holes and other problems.
Exemple #1
0
 public void SetAsByrefDispatch(ref IntPtr value)
 {
     Debug.Assert(IsEmpty); // The setter can only be called once as VariantClear might be needed otherwise
     VariantType = (VarEnum.VT_DISPATCH | VarEnum.VT_BYREF);
     _typeUnion._unionTypes._byref = UnsafeMethods.ConvertIntPtrByrefToPtr(ref value);
 }
Exemple #2
0
 public void SetAsByrefVariant(ref Variant value)
 {
     Debug.Assert(IsEmpty); // The setter can only be called once as VariantClear might be needed otherwise
     VariantType = (VarEnum.VT_VARIANT | VarEnum.VT_BYREF);
     _typeUnion._unionTypes._byref = UnsafeMethods.ConvertVariantByrefToPtr(ref value);
 }
        public static object GetObjectForVariant(Variant variant)
        {
            IntPtr ptr = UnsafeMethods.ConvertVariantByrefToPtr(ref variant);

            return(System.Runtime.InteropServices.Marshal.GetObjectForNativeVariant(ptr));
        }