# DecodedBarcodesUnit Class

The `DecodedBarcodesUnit` class represents a unit that contains decoded barcode elements. It inherits from the `IntermediateResultUnit` class.

## Definition

*Namespace:* Dynamsoft.DBR.intermediate_results


*Inheritance:* [IntermediateResultUnit](https://www.dynamsoft.com/capture-vision/docs/server/programming/dotnet/api-reference/core/intermediate-results/intermediate-result-unit.md) -> DecodedBarcodesUnit

```csharp
class DecodedBarcodesUnit : IntermediateResultUnit, IEnumerable<DecodedBarcodeElement>
```

## Methods

| Method                            | Description |
|-----------------------------------|-------------|
| [`GetCount`](#getcount)           | Gets the number of decoded barcodes in the unit.|
| [`GetDecodedBarcode`](#getdecodedbarcode)           | Gets the `DecodedBarcodeElement` object at the specified index.|
| [`GetDecodedBarcodes`](#getdecodedbarcodes)           | Gets all the `DecodedBarcodeElement` objects.|
| [`RemoveAllDecodedBarcodes`](#removealldecodedbarcodes)           | Removes all the decoded barcodes in the unit.|
| [`SetDecodedBarcode`](#setdecodedbarcode)           | Sets the decoded barcode.|

### Inherited Methods

Checkout inherited methods from [IntermediateResultUnit](https://www.dynamsoft.com/capture-vision/docs/server/programming/dotnet/api-reference/core/intermediate-results/intermediate-result-unit.md) for more details.

### GetCount

Gets the number of decoded barcodes in the unit.

```csharp
int GetCount()
```

**Return value**

Returns the number of decoded barcodes in the unit.

### GetDecodedBarcode

Gets the `DecodedBarcodeElement` object at the specified index.

```csharp
DecodedBarcodeElement GetDecodedBarcode(int index)
```

**Parameter**

`[in] index` The index of the desired `DecodedBarcodeElement` object.

**Return value**

Returns the `DecodedBarcodeElement` object at the specified index.

**See Also**

[DecodedBarcodeElement](https://www.dynamsoft.com/barcode-reader/docs/server/programming/dotnet/api-reference/decoded-barcode-element.md)

### GetDecodedBarcodes

Gets all the `DecodedBarcodeElement` objects.

```csharp
DecodedBarcodeElement[] GetDecodedBarcodes()
```

**Return value**

Returns all the `DecodedBarcodeElement` objects.

**See Also**

[DecodedBarcodeElement](https://www.dynamsoft.com/barcode-reader/docs/server/programming/dotnet/api-reference/decoded-barcode-element.md)

### RemoveAllDecodedBarcodes

Removes all the decoded barcodes in the unit.

```csharp
void RemoveAllDecodedBarcodes()
```

### SetDecodedBarcode

Sets the decoded barcode.

```csharp
int SetDecodedBarcode(DecodedBarcodeElement decodedBarcodeElement, double[] matrixToOriginalImage = null)
```

**Parameters**

`decodedBarcodeElement` The decoded barcode element.

`matrixToOriginalImage` The matrix to original image.

**Return value**

Returns 0 if successful, otherwise returns a negative value.

**See Also**

[DecodedBarcodeElement](https://www.dynamsoft.com/barcode-reader/docs/server/programming/dotnet/api-reference/decoded-barcode-element.md)
