(Type type)
| 355 | internal static object MarshalToManaged(IntPtr nativePtr, Type type) |
| 356 | { |
| 357 | static MarshalToManagedDelegate Factory(Type type) |
| 358 | { |
| 359 | Type marshalType = type; |
| 360 | if (marshalType.IsByRef) |
| 361 | marshalType = marshalType.GetElementType(); |
| 362 | else if (marshalType.IsPointer) |
| 363 | marshalType = typeof(IntPtr); |
| 364 | |
| 365 | MethodInfo method = typeof(MarshalHelper<>).MakeGenericType(marshalType).GetMethod(nameof(MarshalHelper<ReferenceTypePlaceholder>.ToManagedWrapper), BindingFlags.Static | BindingFlags.NonPublic); |
| 366 | return method.CreateDelegate<MarshalToManagedDelegate>(); |
| 367 | } |
| 368 | |
| 369 | if (!toManagedMarshallers.TryGetValue(type, out var deleg)) |
| 370 | deleg = toManagedMarshallers.GetOrAdd(type, Factory); |
nothing calls this directly
no test coverage detected