# Sandbox.Internal.TypeLibrary.ToBytes

## Overload 1

```csharp
byte[] ToBytes(T value)
```

Serialize this value to bytes, where possible

### Parameters

- `value` (`T`)

### Returns

`byte[]`

## Overload 2

```csharp
void ToBytes(T value, ref ByteStream bs)
```

Serialize this value to bytes, where possible

### Parameters

- `value` (`T`)
- `ref bs` (`ByteStream`)

Declared in [Sandbox.Internal.TypeLibrary](/api/Sandbox.Internal.TypeLibrary).
Assembly: `Sandbox.Reflection`.
