Example #1
0
 protected override void NativePointerUpdated(IntPtr oldNativePointer)
 {
     base.NativePointerUpdated(oldNativePointer);
     if (this.NativePointer != IntPtr.Zero)
     {
         this.nativePropertyBag = (PropertyBag.IPropertyBag2)Marshal.GetObjectForIUnknown(this.NativePointer);
     }
     else
     {
         this.nativePropertyBag = (PropertyBag.IPropertyBag2)null;
     }
 }
Example #2
0
        public void Set(string name, object value)
        {
            this.CheckIfInitialized();
            object obj1 = this.Get(name);

            value = Convert.ChangeType(value, obj1 == null ? value.GetType() : obj1.GetType());
            PropertyBag.PROPBAG2 propbaG2 = new PropertyBag.PROPBAG2()
            {
                Name = name
            };
            PropertyBag.IPropertyBag2 propertyBag2 = this.nativePropertyBag;
            int cProperties = 1;

            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            PropertyBag.PROPBAG2& pPropBag = @propbaG2;
            object obj2 = value;
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            object& local = @obj2;

            propertyBag2.Write(cProperties, pPropBag, local).CheckError();
            propbaG2.Dispose();
        }