---
title: "TemplateEngine.Instantiate"
url: "https://reference.aspose.com/email/net/aspose.email.tools.merging/templateengine/instantiate/"
product: "Aspose.Email for .NET API Reference"
description: "TemplateEngine method. Instantiates the template with a DataTable as datasource"
---

## Instantiate(DataTable, IColumnMappingCollection) {#instantiate_3}

Instantiates the template with a DataTable as datasource.

```csharp
public MailMessageCollection Instantiate(DataTable table, IColumnMappingCollection mappings)
```

| Parameter | Type | Description |
| --- | --- | --- |
| table | DataTable | The DataTable, which contains the source data to instantiate the template. |
| mappings | IColumnMappingCollection | The IColumnMappingCollection, which represents the mapping between the source column in DataTable and target field in template |

### Return Value

A MailMessageCollection that generated by the template and the datasource.

### See Also

* class [MailMessageCollection](../../../aspose.email/mailmessagecollection/)
* class [TemplateEngine](../)
* namespace [Aspose.Email.Tools.Merging](../../templateengine/)
* assembly [Aspose.Email](../../../)

---

## Instantiate(DataTable) {#instantiate_2}

Instantiates the template with a DataTable as datasource.

```csharp
public MailMessageCollection Instantiate(DataTable table)
```

| Parameter | Type | Description |
| --- | --- | --- |
| table | DataTable | The DataTable, which contains the source data to instantiate the template. |

### Return Value

A MailMessageCollection that generated by the template and the datasource.

### See Also

* class [MailMessageCollection](../../../aspose.email/mailmessagecollection/)
* class [TemplateEngine](../)
* namespace [Aspose.Email.Tools.Merging](../../templateengine/)
* assembly [Aspose.Email](../../../)

---

## Instantiate(DataRowCollection, IColumnMappingCollection) {#instantiate_1}

Instantiates the template with a DataRowCollection as datasource.

```csharp
public MailMessageCollection Instantiate(DataRowCollection rows, IColumnMappingCollection mappings)
```

| Parameter | Type | Description |
| --- | --- | --- |
| rows | DataRowCollection | The DataRowCollection, which contains the source data to instantiate the template. |
| mappings | IColumnMappingCollection | The IColumnMappingCollection, which represents the mapping between the source column in data source and target field in template |

### Return Value

A MailMessageCollection that generated by the template and the datasource.

### See Also

* class [MailMessageCollection](../../../aspose.email/mailmessagecollection/)
* class [TemplateEngine](../)
* namespace [Aspose.Email.Tools.Merging](../../templateengine/)
* assembly [Aspose.Email](../../../)

---

## Instantiate(DataRowCollection) {#instantiate}

Instantiates the template with a DataRowCollection as datasource.

```csharp
public MailMessageCollection Instantiate(DataRowCollection rows)
```

| Parameter | Type | Description |
| --- | --- | --- |
| rows | DataRowCollection | The DataRowCollection, which contains the source data to instantiate the template. |

### Return Value

A MailMessageCollection that generated by the template and the datasource.

### See Also

* class [MailMessageCollection](../../../aspose.email/mailmessagecollection/)
* class [TemplateEngine](../)
* namespace [Aspose.Email.Tools.Merging](../../templateengine/)
* assembly [Aspose.Email](../../../)

---

## Instantiate(IDataReader) {#instantiate_4}

Instantiates the template with a IDataReader as datasource.

```csharp
public MailMessageCollection Instantiate(IDataReader reader)
```

| Parameter | Type | Description |
| --- | --- | --- |
| reader | IDataReader | The IDataReader, which will provide the source data to instantiate the template. |

### Return Value

A MailMessageCollection that generated by the template and the datasource.

### See Also

* class [MailMessageCollection](../../../aspose.email/mailmessagecollection/)
* class [TemplateEngine](../)
* namespace [Aspose.Email.Tools.Merging](../../templateengine/)
* assembly [Aspose.Email](../../../)


