Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateWrapperOfType()

static ? object System.Runtime.InteropServices.Marshal.CreateWrapperOfType ( object? o,
Type t )
inlinestatic

Definition at line 451 of file Marshal.cs.

452 {
454 {
455 throw new NotSupportedException(SR.NotSupported_COM);
456 }
457 if ((object)t == null)
458 {
459 throw new ArgumentNullException("t");
460 }
461 if (!t.IsCOMObject)
462 {
463 throw new ArgumentException(SR.Argument_TypeNotComObject, "t");
464 }
465 if (t.IsGenericType)
466 {
467 throw new ArgumentException(SR.Argument_NeedNonGenericType, "t");
468 }
469 if (o == null)
470 {
471 return null;
472 }
473 if (!o.GetType().IsCOMObject)
474 {
475 throw new ArgumentException(SR.Argument_ObjNotComObject, "o");
476 }
477 if (o.GetType() == t)
478 {
479 return o;
480 }
481 object obj = GetComObjectData(o, t);
482 if (obj == null)
483 {
485 if (!SetComObjectData(o, t, obj))
486 {
487 obj = GetComObjectData(o, t);
488 }
489 }
490 return obj;
491 }
static object InternalCreateWrapperOfType(object o, Type t)
static bool SetComObjectData(object obj, object key, object? data)
Definition Marshal.cs:428
static ? object GetComObjectData(object obj, object key)
Definition Marshal.cs:406

References System.SR.Argument_NeedNonGenericType, System.SR.Argument_ObjNotComObject, System.SR.Argument_TypeNotComObject, System.Runtime.InteropServices.Marshal.GetComObjectData(), System.Runtime.InteropServices.Marshal.InternalCreateWrapperOfType(), System.Runtime.InteropServices.Marshal.IsBuiltInComSupported, System.Type.IsCOMObject, System.Type.IsGenericType, System.SR.NotSupported_COM, System.obj, and System.Runtime.InteropServices.Marshal.SetComObjectData().

Referenced by System.Runtime.InteropServices.Marshal.CreateWrapperOfType< T, TWrapper >().