IronPython.Modules.MemoryHolder.AddObject C# (CSharp) Method

AddObject() private method

Used to track the lifetime of objects when one memory region depends upon another memory region. For example if you have an array of objects that each have an element which has it's own lifetime the array needs to keep the individual elements alive. The keys used here match CPython's keys as tested by CPython's test_ctypes. Typically they are a string which is the array index, "ffffffff" when from_buffer is used, or when it's a simple type there's just a string instead of the full dictionary - we store that under the key "str".
private AddObject ( object key, object value ) : void
key object
value object
return void
        internal void AddObject(object key, object value) {
            EnsureObjects()[key] = value;
        }

Usage Example

Ejemplo n.º 1
0
 public Pointer(CData value) {
     _object = value; // Keep alive the object, more to do here.
     _memHolder = new MemoryHolder(IntPtr.Size);
     _memHolder.WriteIntPtr(0, value._memHolder);
     _memHolder.AddObject("1", value);
     if (value._objects != null) {
         _memHolder.AddObject("0", value._objects);
     }
 }
All Usage Examples Of IronPython.Modules.MemoryHolder::AddObject