Marshal.CreateAggregatedObject<T> Method (IntPtr, T)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

[Supported in the .NET Framework 4.5.1 and later versions]

Aggregates a managed object of the specified type with the specified COM object.

Namespace:   System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)

public static IntPtr CreateAggregatedObject<T>(
	IntPtr pOuter,
	T o


Type: System.IntPtr

The outer IUnknown pointer.

Type: T

The managed object to aggregate.

Return Value

Type: System.IntPtr

The inner IUnknown pointer of the managed object.

Type Parameters


The type of the managed object to aggregate.

Exception Condition

o is a Windows Runtime object.

TheCreateAggregatedObject<T> method aggregates the inner managed pointer of a managed object of a specified type with the specified outer pointer, and returns an inner IUnknown pointer of the managed object.


requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

Universal Windows Platform
Available since 8.1
.NET Framework
Available since 4.5.1
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1
Return to top