MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / AddDictionaryItem

Method AddDictionaryItem

Source/Engine/Scripting/Scripting.cs:228–238  ·  view source on GitHub ↗
(IDictionary dictionary, object key, object value)

Source from the content-addressed store, hash-verified

226 }
227
228 internal static void AddDictionaryItem(IDictionary dictionary, object key, object value)
229 {
230 // TODO: more generic approach to properly add value that is of custom boxed type? (eg. via NativeInterop.MarshalToManaged)
231 if (value is ManagedArray managedArray)
232 {
233 var managedArrayHandle = ManagedHandle.Alloc(managedArray, GCHandleType.Normal);
234 value = NativeInterop.MarshalToManaged((IntPtr)managedArrayHandle, managedArray.ArrayType);
235 managedArrayHandle.Free();
236 }
237 dictionary.Add(key, value);
238 }
239
240 internal static object[] GetDictionaryKeys(IDictionary dictionary)
241 {

Callers

nothing calls this directly

Calls 4

MarshalToManagedMethod · 0.80
AllocMethod · 0.45
FreeMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected