> For the complete documentation index, see [llms.txt](https://docs.wisej.com/ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/ai/components/api/smartadapter/wisej.ai.adapters.smartobjectadapter.md).

# SmartObjectAdapter

Namespace: **Wisej.AI.Adapters**

Assembly: **Wisej.AI** (3.5.0.0)

* [SmartAdapter](/ai/components/api/smartadapter.md)
  * [SmartObjectAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smartobjectadapter.md)

Converts unstructured text into a structured .NET object.

{% tabs %}
{% tab title="C#" %}

```csharp
public class SmartObjectAdapter : SmartAdapter
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class SmartObjectAdapter
    Inherits SmartAdapter
```

{% endtab %}
{% endtabs %}

This class provides methods to convert text, images, streams, and clipboard content into .NET objects. It supports OCR for image processing and can handle multiple iterations to resolve missing values.

## Constructors

### ![](/files/ptrKjmmRoQB76pvrIqh0) SmartObjectAdapter()

Initializes a new instance of the [SmartObjectAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smartobjectadapter.md) class.

### ![](/files/ptrKjmmRoQB76pvrIqh0) SmartObjectAdapter(container)

Initializes a new instance of the [SmartObjectAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smartobjectadapter.md) class with the specified container.

| Name          | Type                                                                                 | Description                                                                                                                             |
| ------------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| **container** | [IContainer](https://docs.microsoft.com/dotnet/api/system.componentmodel.icontainer) | An [IContainer](https://docs.microsoft.com/dotnet/api/system.componentmodel.icontainer) that represents the container of the component. |

## Properties

### ![](/files/ptrKjmmRoQB76pvrIqh0) MaxIterations

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Gets or sets the maximum number of times the adapter will try to use the available tools to complete the missing values. (Default: `2`)

If the adapter was not provided any tool, this property is ignored since it will not try to resolve missing values.

### ![](/files/ptrKjmmRoQB76pvrIqh0) UseOCR

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Gets or sets a value indicating whether OCR should be used for image processing. (Default: `False`)

## Methods

### ![](/files/KL0Ik37djZRr8a07Wopd) Dispose(disposing)

Releases the unmanaged resources used by the [SmartObjectAdapter](/ai/components/api/smartadapter/wisej.ai.adapters.smartobjectadapter.md) and optionally releases the managed resources.

| Parameter     | Type                                                            | Description                                                                                      |
| ------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **disposing** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true to release both managed and unmanaged resources; false to release only unmanaged resources. |

### ![](/files/ptrKjmmRoQB76pvrIqh0) FromClipboardAsync\<T>()

Converts the clipboard content to an object of type *T* .

| Parameter | Type | Description                       |
| --------- | ---- | --------------------------------- |
| **T**     |      | The type of the object to return. |

**Returns:** [Task\<T>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains the converted object.

### ![](/files/ptrKjmmRoQB76pvrIqh0) FromClipboardAsync(objectType)

Converts the clipboard content to an object of the specified type.

| Parameter      | Type                                                      | Description                       |
| -------------- | --------------------------------------------------------- | --------------------------------- |
| **objectType** | [Type](https://docs.microsoft.com/dotnet/api/system.type) | The type of the object to return. |

**Returns:** [Task\<Object>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains the converted object.

### ![](/files/ptrKjmmRoQB76pvrIqh0) FromImageAsync\<T>(image)

Converts the specified image to an object of type *T* .

| Parameter | Type                                                                | Description                       |
| --------- | ------------------------------------------------------------------- | --------------------------------- |
| **T**     |                                                                     | The type of the object to return. |
| **image** | [Image](https://docs.microsoft.com/dotnet/api/system.drawing.image) | The image to convert.             |

**Returns:** [Task\<T>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains the converted object.

### ![](/files/ptrKjmmRoQB76pvrIqh0) FromImageAsync(image, objectType)

Converts the specified image to an object of the specified type.

| Parameter      | Type                                                                | Description                       |
| -------------- | ------------------------------------------------------------------- | --------------------------------- |
| **image**      | [Image](https://docs.microsoft.com/dotnet/api/system.drawing.image) | The image to convert.             |
| **objectType** | [Type](https://docs.microsoft.com/dotnet/api/system.type)           | The type of the object to return. |

**Returns:** [Task\<Object>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains the converted object.

### ![](/files/ptrKjmmRoQB76pvrIqh0) FromStreamAsync\<T>(stream, streamType)

Converts the specified stream to an object of type *T* .

| Parameter                                       | Type                                                             | Description                              |
| ----------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------- |
| **T**                                           |                                                                  | The type of the object to return.        |
| **stream**                                      | [Stream](https://docs.microsoft.com/dotnet/api/system.io.stream) | The stream to convert.                   |
| **streamType** ![](/files/52BqKf9SltWQ97FbQSBF) | [String](https://docs.microsoft.com/dotnet/api/system.string)    | The type of the stream. Default is null. |

**Returns:** [Task\<T>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains the converted object.

### ![](/files/ptrKjmmRoQB76pvrIqh0) FromStreamAsync(stream, objectType, streamType)

Converts the specified stream to an object of the specified type.

| Parameter                                       | Type                                                             | Description                              |
| ----------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------- |
| **stream**                                      | [Stream](https://docs.microsoft.com/dotnet/api/system.io.stream) | The stream to convert.                   |
| **objectType**                                  | [Type](https://docs.microsoft.com/dotnet/api/system.type)        | The type of the object to return.        |
| **streamType** ![](/files/52BqKf9SltWQ97FbQSBF) | [String](https://docs.microsoft.com/dotnet/api/system.string)    | The type of the stream. Default is null. |

**Returns:** [Task\<Object>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains the converted object.

### ![](/files/ptrKjmmRoQB76pvrIqh0) FromTextAsync\<T>(text)

Converts the specified text to an object of type *T* .

| Parameter | Type                                                          | Description                       |
| --------- | ------------------------------------------------------------- | --------------------------------- |
| **T**     |                                                               | The type of the object to return. |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to convert.              |

**Returns:** [Task\<T>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains the converted object.

### ![](/files/ptrKjmmRoQB76pvrIqh0) FromTextAsync(text, objectType)

Converts the specified text to an object of the specified type.

| Parameter      | Type                                                          | Description                       |
| -------------- | ------------------------------------------------------------- | --------------------------------- |
| **text**       | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to convert.              |
| **objectType** | [Type](https://docs.microsoft.com/dotnet/api/system.type)     | The type of the object to return. |

**Returns:** [Task\<Object>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains the converted object.

### ![](/files/ptrKjmmRoQB76pvrIqh0) OnObjectParsed(args)

Raises the [ObjectParsed](#objectparsed) event.

| Parameter | Type                                                                                                             | Description                                                                                                                                              |
| --------- | ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **args**  | [ObjectParsedEventArgs](https://docs.wisej.com/api?q=wisej.ai.adapters.smartobjectadapter+objectparsedeventargs) | The [ObjectParsedEventArgs](https://docs.wisej.com/api?q=wisej.ai.adapters.smartobjectadapter.objectparsedeventargs) instance containing the event data. |

### ![](/files/KL0Ik37djZRr8a07Wopd) RunAsyncCore(control)

Executes the core logic of the adapter asynchronously.

| Parameter   | Type                                                      | Description                           |
| ----------- | --------------------------------------------------------- | ------------------------------------- |
| **control** | [Control](https://docs.wisej.com/api?q=wisej.web.control) | The control to use for the operation. |

**Returns:** [Task\<Message>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous operation. The task result contains the response message.

## Events

### ![](/files/ptrKjmmRoQB76pvrIqh0) ObjectParsed

[ObjectParsedEventHandler](https://docs.wisej.com/api?q=wisej.ai.adapters.smartobjectadapter+objectparsedeventhandler) Occurs when an object is parsed.

## Implements

| Name                                                                              | Description                                |
| --------------------------------------------------------------------------------- | ------------------------------------------ |
| [IToolProvider](/ai/components/api/smarttool/wisej.ai.smarttool.itoolprovider.md) | Represents a provider that supplies tools. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wisej.com/ai/components/api/smartadapter/wisej.ai.adapters.smartobjectadapter.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
