ClearScript Library
ClearScript Library
ClearScript Library Reference
Microsoft.ClearScript
HostFunctions Class
HostFunctions Methods
newArr Method
newArr(Int32[]) Method
newArr<T>(Int32[]) Method

# HostFunctionsnewArr T(Int32) Method

Creates a host array with the specified element type.
Namespace: Microsoft.ClearScript
Assembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.5.0
Syntax
C#
VB
C++
F#
Copy

    public Object newArr<T>(
    	params int[] lengths
    )

    Public Function newArr(Of T) (
    	ParamArray lengths As Integer()
    ) As Object

    public:
    generic<typename T>
    Object^ newArr(
    	... array<int>^ lengths
    )

    member newArr :
            lengths : int[] -> Object

#### Parameters

lengths Int32
  One or more integers representing the array dimension lengths.

#### Type Parameters

T
  The element type of the array to create.

#### Return Value

Object
A new host array with the specified element type.
Remarks
For information about the mapping between host members and script-callable properties and methods, see AddHostObject.
Example
The following code creates a 5x3 host array of strings. It assumes that an instance of ExtendedHostFunctions is exposed under the name "host" (see AddHostObject).
JavaScript
Copy

    var StringT = host.type("System.String");
    var array = host.newArr(StringT, 5, 3);

See Also

#### Reference

HostFunctions Class
newArr Overload
Microsoft.ClearScript Namespace
newArr(Int32)
type(String, Object)

Copyright © Microsoft Corporation. All rights reserved.

Send comments on this topic to Microsoft