---
lang: en
title: 'API docs: context.binding.toclass'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.context.binding.toclass.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [Binding](./context.binding.md) &gt; [toClass](./context.binding.toclass.md)

## Binding.toClass() method

Bind the key to an instance of the given class.

<b>Signature:</b>

```typescript
toClass(ctor: Constructor<T>): this;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  ctor | <code>Constructor&lt;T&gt;</code> | The class constructor to call. Any constructor arguments must be annotated with <code>@inject</code> so that we can resolve them from the context. |

<b>Returns:</b>

`this`


