# Box

> Convert primitive to it's object counterpart.

## Definition

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

## Box(sbyte)

Convert primitive to it's object counterpart.

```csharp
public static nint Box(sbyte value)
```

### Parameters

**** (\[sbyte]\(https\://learn.microsoft.com/dotnet/api/system.sbyte)): Primitive value to be boxed.

### Returns

| Type                                                           | Description                       |
| -------------------------------------------------------------- | --------------------------------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) | A local reference to Java object. |

### Remarks

Each primitive type in Java has a counterpart class, for example java.lang.Integer class is a counterpart for primitive type int.

## Box(short)

Convert primitive to it's object counterpart.

```csharp
public static nint Box(short value)
```

### Parameters

**** (\[short]\(https\://learn.microsoft.com/dotnet/api/system.int16)): Primitive value to be boxed.

### Returns

| Type                                                           | Description                       |
| -------------------------------------------------------------- | --------------------------------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) | A local reference to Java object. |

### Remarks

Each primitive type in Java has a counterpart class, for example java.lang.Integer class is a counterpart for primitive type int.

## Box(int)

Convert primitive to it's object counterpart.

```csharp
public static nint Box(int value)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Primitive value to be boxed.

### Returns

| Type                                                           | Description                       |
| -------------------------------------------------------------- | --------------------------------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) | A local reference to Java object. |

### Remarks

Each primitive type in Java has a counterpart class, for example java.lang.Integer class is a counterpart for primitive type int.

## Box(long)

Convert primitive to it's object counterpart.

```csharp
public static nint Box(long value)
```

### Parameters

**** (\[long]\(https\://learn.microsoft.com/dotnet/api/system.int64)): Primitive value to be boxed.

### Returns

| Type                                                           | Description                       |
| -------------------------------------------------------------- | --------------------------------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) | A local reference to Java object. |

### Remarks

Each primitive type in Java has a counterpart class, for example java.lang.Integer class is a counterpart for primitive type int.

## Box(float)

Convert primitive to it's object counterpart.

```csharp
public static nint Box(float value)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Primitive value to be boxed.

### Returns

| Type                                                           | Description                       |
| -------------------------------------------------------------- | --------------------------------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) | A local reference to Java object. |

### Remarks

Each primitive type in Java has a counterpart class, for example java.lang.Integer class is a counterpart for primitive type int.

## Box(double)

Convert primitive to it's object counterpart.

```csharp
public static nint Box(double value)
```

### Parameters

**** (\[double]\(https\://learn.microsoft.com/dotnet/api/system.double)): Primitive value to be boxed.

### Returns

| Type                                                           | Description                       |
| -------------------------------------------------------------- | --------------------------------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) | A local reference to Java object. |

### Remarks

Each primitive type in Java has a counterpart class, for example java.lang.Integer class is a counterpart for primitive type int.

## Box(char)

Convert primitive to it's object counterpart.

```csharp
public static nint Box(char value)
```

### Parameters

**** (\[char]\(https\://learn.microsoft.com/dotnet/api/system.char)): Primitive value to be boxed.

### Returns

| Type                                                           | Description                       |
| -------------------------------------------------------------- | --------------------------------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) | A local reference to Java object. |

### Remarks

Each primitive type in Java has a counterpart class, for example java.lang.Integer class is a counterpart for primitive type int.

## Box(bool)

Convert primitive to it's object counterpart.

```csharp
public static nint Box(bool value)
```

### Parameters

**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Primitive value to be boxed.

### Returns

| Type                                                           | Description                       |
| -------------------------------------------------------------- | --------------------------------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) | A local reference to Java object. |

### Remarks

Each primitive type in Java has a counterpart class, for example java.lang.Integer class is a counterpart for primitive type int.
