# DataSnapshot Constructor

> DataSnapshot constructor in the TX Sheet Control .NET API: Validates and detaches all input. Covers the parameters columns and rows and a C# example.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Constructor
- **Namespace:** `TXTextControl.TXSheetControl.Data`
- **Package:** `TXTextControl.TXSheetControl.Server` (assembly `TXTextControl.TXSheetControl.Data.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Data > DataSnapshot > DataSnapshot Constructor
- **918 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/datasnapshot/constructor/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/datasnapshot/constructor/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/datasnapshot/constructor/llms-full.txt

---

Validates and detaches all input. Rejects nested values, duplicate headers, nonfinite or unsafe integers.

### Syntax

```csharp
public DataSnapshot(IEnumerable<string> columns, IEnumerable<IEnumerable<object?>> rows)
```

### Parameters

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `columns` | `IEnumerable<string>` | No | Value matching columns's declared type and the owning object's validation rules. |
| `rows` | `IEnumerable<IEnumerable<object?>>` | No | Value matching rows's declared type and the owning object's validation rules. |

### Return Value

`DataSnapshot`.

### Examples

Create a working report from bounded HTTP sales data. Supply an application-owned HttpClient and service URL; scope cached data to its actual audience.

```csharp
using TXTextControl.TXSheetControl.Data;
using TXTextControl.TXSheetControl.Server;

async Task<byte[]> BuildDataSnapshotConstructorAsync(ServerSheetControl control)
{
    var book = control.Workbook;
    var sheet = await book.Sheets.AtAsync(0);
    var data = new DataSnapshot(["Region", "Revenue"], [["North", 42000], ["South", 38500]]);
    await sheet.Range("A1:B1").SetValuesAsync([data.Columns.Cast<object?>().ToArray()]);
    await sheet.Range("A2:B3").SetValuesAsync(data.Rows.Select(row => row.ToArray()).ToArray());
    await sheet.Tables.AddAsync("RegionalSales", "A1:B3", new TableOptions { Style = "TableStyleMedium2", ShowRowStripes = true });
    return await control.SaveAsync(StreamType.PDF);
}
```

### Remarks

Use the member with an instance or settings object from the documented package. Await task-returning operations. Document-bound handles must be resolved again after loading or deleting their owner.

### See Also

- [DataSnapshot Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/datasnapshot/llms-full.txt)
- [Workbooks and Worksheets](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/workbooks/llms-full.txt)

---

## Nearby

- **Previous:** [DataSnapshot Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/datasnapshot/llms-full.txt)
- **Next:** [DataSnapshot.Columns Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/datasnapshot/columns-property/llms-full.txt)
