Редактиране

Споделяне чрез


Platform::Array Class

Represents a one-dimensional, modifiable array that can be received and passed across the application binary interface (ABI).

Syntax

template <typename T>
private ref class Array<TArg, 1> :
    public WriteOnlyArray<TArg, 1>,
    public IBoxArray<TArg>

Members

Platform::Array inherits all its methods from Platform::WriteOnlyArray Class and implements the Value property of the Platform::IBoxArray Interface.

Public Constructors

Name Description
Array Constructors Initializes a one-dimensional, modifiable array of types specified by the class template parameter, T.

Methods

See Platform::WriteOnlyArray Class.

Properties

Name Description
Array::Value Retrieves a handle to the current array.

Remarks

The Array class is sealed and cannot be inherited.

The Windows Runtime type system does not support the concept of jagged arrays and therefore you cannot pass an IVector<Platform::Array<T>> as a return value or method parameter. To pass a jagged array or a sequence of sequences across the ABI, use IVector<IVector<T>^>.

For more information about when and how to use Platform::Array, see Array and WriteOnlyArray.

This class is defined in the vccorlib.h header, which is automatically included by the compiler. It is visible in IntelliSense but not in Object Browser because it is not a public type defined in platform.winmd.

Requirements

Compiler option: /ZW

Array Constructors

Initializes a one-dimensional, modifiable array of types specified by the class template parameter, T.

Syntax

Array(unsigned int size);
Array(T* data, unsigned int size);

Parameters

T
Class template parameter.

size
The number of elements in the array.

data
A pointer to an array of data of type T that is used to initialize this Array object.

Remarks

For more information about how to create instances of Platform::Array, see Array and WriteOnlyArray.

Array::get Method

Retrieves a reference to the array element at the specified index location.

Syntax

T& get(unsigned int index)  const;

Parameters

index
A zero-based index that identifies an element in the array. The minimum index is 0 and the maximum index is the value specified by the size parameter in the Array constructor.

Return Value

The array element specified by the index parameter.

Array::Value Property

Retrieves a handle to the current array.

Syntax

property Array^ Value;

Return Value

A handle to the current array.

See also

Platform namespace
Array and WriteOnlyArray