Skip to main content
Platform namespace (C++/CX)

Contains built-in types that are compatible with the Windows Runtime.

using namespace Platform;

The Platform namespace inherits from the IUnknown interface but does not have additional members.


The Platform namespace contains, attributes, classes, enumerations, interfaces, and structures. Platform also contains and sub-namespaces.




Indicates that an enumeration can be treated as a bit field; that is, a set of flags.


Indicates that the threading model for an application is multi-threaded apartment (MTA).


Indicates that the threading model for an application is single-threaded apartment (STA).


The Platform namespace has the following classes.



Platform::AccessDeniedException Class

Raised when access is denied to a resource or feature.

Platform::Agile Class

Represents a non-agile object as an agile object.

Platform::Array Class

Represents a one-dimensional, modifiable array.

Platform::ArrayReference Class

Represents an array whose initialization is optimized to minimize copying operations.

Platform::Box Class

Used to declare a boxed type that encapsulates a value type such as Windows::Foundation::DateTime or int64 when that type is passed across the application binary interface (ABI) or stored in a variable of type Platform::Object^.

Platform::ChangedStateException Class

Thrown when methods of a collection iterator or a collection view are called after the parent collection has changed, invalidating the results of the method.

Platform::ClassNotRegisteredException Class

Thrown when a COM class has not been registered.

Platform::COMException Class

Represents the exception that is thrown when an unrecognized value is returned from a COM method call.

Platform::Delegate Class

Represents the signature of a callback function.

Platform::DisconnectedException Class

The object has disconnected from its clients.

Platform::Exception Class

Represents errors that occur during application execution. The base class for exceptions.

Platform::FailureException Class

Thrown when the operation has failed. It is the equivalent of the E_FAIL HRESULT.

Platform::InvalidArgumentException Class

Thrown when one of the arguments provided to a method is not valid.

Platform::InvalidCastException Class

Thrown in cases of invalid casting or explicit conversion.

Platform::MTAThreadAttribute Class

Indicates that the threading model for an application is multi-threaded apartment (MTA).

Platform::NotImplementedException Class

Thrown if an interface method has not been implemented on the class.

Platform::NullReferenceException Class

Thrown when there is an attempt to dereference a null object reference.

Platform::Object Class

A base class that provides common behavior.

Platform::ObjectDisposedException Class

Thrown when an operation is performed on a disposed object.

Platform::OperationCanceledException Class

Thrown when an operation is aborted.

Platform::OutOfBoundsException Class

Thrown when an operation attempts to access data outside the valid range.

Platform::OutOfMemoryException Class

Thrown when there's insufficient memory to complete the operation.

Platform::STAThreadAttribute Class

Indicates that the threading model for an application is single-threaded apartment (STA).

Platform::String Class

A sequential collection of Unicode characters that is used to represent text.

Platform::StringReference Class

Enables access to string buffers with minimum of copy overhead.

Platform::Type Class

Identifies a built-in type by a category enumeration.

Platform::ValueType Class

The base class for instances of value types.

Platform::WeakReference Class

Provides a weak reference to ref class objects that does not increment the reference count.

Platform::WriteOnlyArray Class

Represents a one-dimensional write-only array which is used as an input parameter on methods that implement the FillArray pattern.

Platform::WrongThreadException Class

Thrown when a thread calls via an interface pointer which is for a proxy object that does not belong to the thread's apartment.

Interface implementations

The Platform namespace defines the following interfaces.



Platform::IBox Interface

Used to pass value types to functions whose parameters are typed as Platform::Object^.

Platform::IBoxArray Interface

Interface used to pass arrays of value types to functions whose parameters are typed as Platform::Array.

Platform::IDisposable Interface

Used to release unmanaged resources.


The Platform namespace has the following enumerations.



Platform::CallbackContext Enumeration

An enumeration that is used as a parameter of the delegate constructor. It determines whether the callback is to be marshalled to the originating thread or to the caller thread.

Platform::TypeCode Enumeration

Specifies a numeric category that represents a built-in type.


The Platform namespace has the following structures.



Platform::Enum Class

Represents a named constant.

Platform::Guid value class

Represents a GUID.

Platform::IntPtr value class

A signed pointer whose size is appropriate for the platform (32-bit or 64-bit).

Platform::SizeT value class

An unsigned data type used to represent the size of an object.

Platform::UIntPtr value class

An unsigned pointer whose size is appropriate for the platform (32-bit or 64-bit).