# DataObject

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

Implements a basic data transfer mechanism.

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

```csharp
public class DataObject : IDataObject
```

{% endtab %}

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

```visual-basic
Public Class DataObject
    Inherits IDataObject
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) DataObject()

Initializes a new instance of the [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) class.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) DataObject(data)

Initializes a new instance of the [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) class and adds the specified object to it.

| Name     | Type                                                          | Description        |
| -------- | ------------------------------------------------------------- | ------------------ |
| **data** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The data to store. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) DataObject(format, data)

Initializes a new instance of the [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) class and adds the specified object in the specified format.

| Name       | Type                                                          | Description                                                                                                                                          |
| ---------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| **format** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The format of the specified data. See [DataFormats](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.dataformats) for predefined formats. |
| **data**   | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The data to store.                                                                                                                                   |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) DataObject(format, data)

Initializes a new instance of the [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) class and adds the specified object in the specified format.

| Name       | Type                                                          | Description                                                                                      |
| ---------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **format** | [Type](https://docs.microsoft.com/dotnet/api/system.type)     | A [Type](https://docs.microsoft.com/dotnet/api/system.type) representing the format of the data. |
| **data**   | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The data to store.                                                                               |

## Methods

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ContainsAudio()

Indicates whether the data object contains data in the [WaveAudio](https://docs.wisej.com/api/enumerations/wisej.web.dataformats#fields) format.

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the data object contains audio data; otherwise, false.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ContainsFileDropList()

Indicates whether the data object contains data that is in the [FileDrop](https://docs.wisej.com/api/enumerations/wisej.web.dataformats#fields) format or can be converted to that format.

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the data object contains a file drop list; otherwise, false.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ContainsImage()

Indicates whether the data object contains data that is in the [Bitmap](https://docs.wisej.com/api/enumerations/wisej.web.dataformats#fields) format or can be converted to that format.

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the data object contains image data; otherwise, false.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ContainsText()

Indicates whether the data object contains data in the [UnicodeText](https://docs.wisej.com/api/enumerations/wisej.web.textdataformat#fields) format.

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the data object contains text data; otherwise, false.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ContainsText(format)

Indicates whether the data object contains text data in the format indicated by the specified [TextDataFormat](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.textdataformat) value.

| Parameter  | Type                                                                                         | Description                                                                                                     |
| ---------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| **format** | [TextDataFormat](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.textdataformat) | One of the [TextDataFormat](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.textdataformat) values. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the data object contains text data in the specified format; otherwise, false.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetAudioStream()

Retrieves an audio stream from the data object.

**Returns:** [Stream](https://docs.microsoft.com/dotnet/api/system.io.stream). A [Stream](https://docs.microsoft.com/dotnet/api/system.io.stream) containing audio data or null if the data object does not contain any data in the [WaveAudio](https://docs.wisej.com/api/enumerations/wisej.web.dataformats#fields) format.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetData(format)

Returns the data associated with the specified class type format.

| Parameter  | Type                                                      | Description                                                                                                  |
| ---------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| **format** | [Type](https://docs.microsoft.com/dotnet/api/system.type) | A [Type](https://docs.microsoft.com/dotnet/api/system.type) representing the format of the data to retrieve. |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). The data associated with the specified format, or null.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetData(format)

Returns the data associated with the specified data format.

| Parameter  | Type                                                          | Description                                                                                                                                            |
| ---------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **format** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The format of the data to retrieve. See [DataFormats](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.dataformats) for predefined formats. |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). The data associated with the specified format, or null.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetData(format, autoConvert)

Returns the data associated with the specified data format, using an automated conversion parameter to determine whether to convert the data to the format.

| Parameter       | Type                                                            | Description                                                                                                                                            |
| --------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **format**      | [String](https://docs.microsoft.com/dotnet/api/system.string)   | The format of the data to retrieve. See [DataFormats](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.dataformats) for predefined formats. |
| **autoConvert** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true to the convert data to the specified format; otherwise, false.                                                                                    |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). The data associated with the specified format, or null.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetDataPresent(format)

Determines whether data stored in this [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) is associated with, or can be converted to, the specified format.

| Parameter  | Type                                                      | Description                                                                                       |
| ---------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| **format** | [Type](https://docs.microsoft.com/dotnet/api/system.type) | A [Type](https://docs.microsoft.com/dotnet/api/system.type) representing the format to check for. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if data stored in this [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) is associated with, or can be converted to, the specified format; otherwise, false.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetDataPresent(format)

Returns the data associated with the specified class type format.

| Parameter  | Type                                                          | Description                                                                                                  |
| ---------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| **format** | [String](https://docs.microsoft.com/dotnet/api/system.string) | A [Type](https://docs.microsoft.com/dotnet/api/system.type) representing the format of the data to retrieve. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). The data associated with the specified format, or null.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetDataPresent(format, autoConvert)

Determines whether this [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) contains data in the specified format or, optionally, contains data that can be converted to the specified format.

| Parameter       | Type                                                            | Description                                                                                                                                                                                                                         |
| --------------- | --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **format**      | [String](https://docs.microsoft.com/dotnet/api/system.string)   | The format to check for. See [DataFormats](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.dataformats) for predefined formats.                                                                                         |
| **autoConvert** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true to determine whether data stored in this [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) can be converted to the specified format; false to check whether the data is in the specified format. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the data is in, or can be converted to, the specified format; otherwise, false.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetFileDropList()

Returns the list of file types from the data object.

**Returns:** [String\[\]](https://docs.microsoft.com/dotnet/api/system.string). A string array containing the file types in the data object.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetFiles()

Returns the [HttpFileCollection](https://docs.wisej.com/api/wisej.core/general/wisej.core.httpfilecollection) of files uploaded by the client in a drag & drop operation.

**Returns:** [HttpFileCollection](https://docs.wisej.com/api/wisej.core/general/wisej.core.httpfilecollection). A string array containing the file types in the data object.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetFormats()

Returns a list of all formats that data stored in this [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) is associated with or can be converted to.

**Returns:** [String\[\]](https://docs.microsoft.com/dotnet/api/system.string). An array of type [String](https://docs.microsoft.com/dotnet/api/system.string), containing a list of all formats that are supported by the data stored in this object.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetFormats(autoConvert)

Returns a list of all formats that data stored in this [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) is associated with or can be converted to, using an automatic conversion parameter to determine whether to retrieve only native data formats or all formats that the data can be converted to.

| Parameter       | Type                                                            | Description                                                                                                                                                                                                                   |
| --------------- | --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **autoConvert** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true to retrieve all formats that data stored in this [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) is associated with, or can be converted to; false to retrieve only native data formats. |

**Returns:** [String\[\]](https://docs.microsoft.com/dotnet/api/system.string). An array of type [String](https://docs.microsoft.com/dotnet/api/system.string), containing a list of all formats that are supported by the data stored in this object.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetImage()

Retrieves an image from the data object.

**Returns:** [Image](https://docs.microsoft.com/dotnet/api/system.drawing.image). An [Image](https://docs.microsoft.com/dotnet/api/system.drawing.image) representing the image data in the data object or null if the data object does not contain any data that is in the [Bitmap](https://docs.wisej.com/api/enumerations/wisej.web.dataformats#fields) format or can be converted to that format.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetText()

Retrieves text data from the data object in the [UnicodeText](https://docs.wisej.com/api/enumerations/wisej.web.textdataformat#fields) format.

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The text data in the data object or [Empty](https://docs.microsoft.com/dotnet/api/system.string.empty) if the data object does not contain data in the [UnicodeText](https://docs.wisej.com/api/enumerations/wisej.web.textdataformat#fields) format.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetText(format)

Retrieves text data from the data object in the format indicated by the specified [TextDataFormat](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.textdataformat) value.

| Parameter  | Type                                                                                         | Description                                                                                                     |
| ---------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| **format** | [TextDataFormat](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.textdataformat) | One of the [TextDataFormat](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.textdataformat) values. |

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The text data in the data object or [Empty](https://docs.microsoft.com/dotnet/api/system.string.empty) if the data object does not contain data in the specified format.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SetAudio(audioBytes)

Adds a [Byte](https://docs.microsoft.com/dotnet/api/system.byte) array to the data object in the [WaveAudio](https://docs.wisej.com/api/enumerations/wisej.web.dataformats#fields) format after converting it to a [Stream](https://docs.microsoft.com/dotnet/api/system.io.stream).

| Parameter      | Type                                                          | Description                                                                                  |
| -------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| **audioBytes** | [Byte\[\]](https://docs.microsoft.com/dotnet/api/system.byte) | A [Byte](https://docs.microsoft.com/dotnet/api/system.byte) array containing the audio data. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*audioBytes* is null.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SetAudio(audioStream)

Adds a [Stream](https://docs.microsoft.com/dotnet/api/system.io.stream) to the data object in the [WaveAudio](https://docs.wisej.com/api/enumerations/wisej.web.dataformats#fields) format.

| Parameter       | Type                                                             | Description                                                                                   |
| --------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| **audioStream** | [Stream](https://docs.microsoft.com/dotnet/api/system.io.stream) | A [Stream](https://docs.microsoft.com/dotnet/api/system.io.stream) containing the audio data. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*audioStream* is null.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SetData(data)

Adds the specified object to the [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) using the object type as the data format.

| Parameter | Type                                                          | Description        |
| --------- | ------------------------------------------------------------- | ------------------ |
| **data**  | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The data to store. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SetData(format, data)

Adds the specified object to the [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) using the specified type as the format.

| Parameter  | Type                                                          | Description                                                                                                   |
| ---------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| **format** | [Type](https://docs.microsoft.com/dotnet/api/system.type)     | A [Type](https://docs.microsoft.com/dotnet/api/system.type) representing the format associated with the data. |
| **data**   | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The data to store.                                                                                            |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SetData(format, data)

Adds the specified object to the [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) using the specified format.

| Parameter  | Type                                                          | Description                                                                                                                                             |
| ---------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **format** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The format associated with the data. See [DataFormats](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.dataformats) for predefined formats. |
| **data**   | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The data to store.                                                                                                                                      |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SetData(format, autoConvert, data)

Adds the specified object to the [DataObject](https://docs.wisej.com/api/wisej.web/general/wisej.web.dataobject) using the specified format and indicating whether the data can be converted to another format.

| Parameter       | Type                                                            | Description                                                                                                                                             |
| --------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **format**      | [String](https://docs.microsoft.com/dotnet/api/system.string)   | The format associated with the data. See [DataFormats](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.dataformats) for predefined formats. |
| **autoConvert** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true to allow the data to be converted to another format; otherwise, false.                                                                             |
| **data**        | [Object](https://docs.microsoft.com/dotnet/api/system.object)   | The data to store.                                                                                                                                      |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SetDownloadURL(url, fileName)

Adds a url using [DownloadURL](https://docs.wisej.com/api/enumerations/wisej.web.dataformats#fields) format. The specified url is parsed to compose the DownloadURL as: "mime-type:file-name:url".

| Parameter    | Type                                                          | Description                                    |
| ------------ | ------------------------------------------------------------- | ---------------------------------------------- |
| **url**      | [String](https://docs.microsoft.com/dotnet/api/system.string) | The url to the file to download.               |
| **fileName** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the file to download from the url. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SetFileDropList(filePaths)

Adds a collection of file names to the data object in the [FileDrop](https://docs.wisej.com/api/enumerations/wisej.web.dataformats#fields) format.

| Parameter     | Type                                                                                                      | Description                                                                                                                            |
| ------------- | --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **filePaths** | [StringCollection](https://docs.microsoft.com/dotnet/api/system.collections.specialized.stringcollection) | A [StringCollection](https://docs.microsoft.com/dotnet/api/system.collections.specialized.stringcollection) containing the file names. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*filePaths* is null.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SetFileDropList(filePaths)

Adds a collection of file names to the data object in the [FileDrop](https://docs.wisej.com/api/enumerations/wisej.web.dataformats#fields) format.

| Parameter     | Type                                                              | Description                                                                                                                            |
| ------------- | ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **filePaths** | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | A [StringCollection](https://docs.microsoft.com/dotnet/api/system.collections.specialized.stringcollection) containing the file names. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*filePaths* is null.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SetImage(image)

Adds an [Image](https://docs.microsoft.com/dotnet/api/system.drawing.image) to the data object in the [Bitmap](https://docs.wisej.com/api/enumerations/wisej.web.dataformats#fields) format.

| Parameter | Type                                                                | Description                                                                                        |
| --------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| **image** | [Image](https://docs.microsoft.com/dotnet/api/system.drawing.image) | The [Image](https://docs.microsoft.com/dotnet/api/system.drawing.image) to add to the data object. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*image* is null.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SetText(textData)

Adds text data to the data object in the [UnicodeText](https://docs.wisej.com/api/enumerations/wisej.web.textdataformat#fields) format.

| Parameter    | Type                                                          | Description                         |
| ------------ | ------------------------------------------------------------- | ----------------------------------- |
| **textData** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to add to the data object. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*textData* is null or [Empty](https://docs.microsoft.com/dotnet/api/system.string.empty).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SetText(textData, format)

Adds text data to the data object in the format indicated by the specified [TextDataFormat](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.textdataformat) value.

| Parameter    | Type                                                                                         | Description                                                                                                     |
| ------------ | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| **textData** | [String](https://docs.microsoft.com/dotnet/api/system.string)                                | The text to add to the data object.                                                                             |
| **format**   | [TextDataFormat](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.textdataformat) | One of the [TextDataFormat](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.textdataformat) values. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)*textData* is null or [Empty](https://docs.microsoft.com/dotnet/api/system.string.empty).

## Implements

| Name                                                                                 | Description                                                    |
| ------------------------------------------------------------------------------------ | -------------------------------------------------------------- |
| [IDataObject](https://docs.wisej.com/api/wisej.web/interfaces/wisej.web.idataobject) | Provides a format-independent mechanism for transferring data. |
