# ToCharArray

> Converts a managed array of System.Char to a Java array of \<tt\>char\</tt\>.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/7000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.AndroidJNIModule

## ToCharArray(char\[])

Converts a managed array of System.Char to a Java array of \\\<tt\\>char\\\</tt\\>.

```csharp
public static nint ToCharArray(char[] array)
```

### Parameters

**** (\[char\[]]\(https\://learn.microsoft.com/dotnet/api/system.char)): The managed array to convert.

### Returns

| Type                                                           | Description                                                    |
| -------------------------------------------------------------- | -------------------------------------------------------------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) | A local reference to the newly constructed Java array of char. |

### Remarks

Additional Resources: [AndroidJNI.NewCharArray](/engine/7000.0/script-reference/unityengine/androidjni/newchararray.md), [AndroidJNI.SetCharArrayElement](/engine/7000.0/script-reference/unityengine/androidjni/setchararrayelement.md)

## ToCharArray(char\*, int)

Converts a managed array of System.Char to a Java array of \\\<tt\\>char\\\</tt\\>.

```csharp
public static nint ToCharArray(char* array, int length)
```

### Parameters

**** (\[char\*]\(https\://learn.microsoft.com/dotnet/api/system.char)): The managed array to convert.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of elements in the array.

### Returns

| Type                                                           | Description                                                    |
| -------------------------------------------------------------- | -------------------------------------------------------------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) | A local reference to the newly constructed Java array of char. |

### Remarks

Additional Resources: [AndroidJNI.NewCharArray](/engine/7000.0/script-reference/unityengine/androidjni/newchararray.md), [AndroidJNI.SetCharArrayElement](/engine/7000.0/script-reference/unityengine/androidjni/setchararrayelement.md)
