# NameCollection Class

> NameCollection class in the TX Sheet Control .NET API: Case-insensitive workbook or worksheet names; every operation uses the same scope as the JS collection.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Class
- **Namespace:** `TXTextControl.TXSheetControl.Server`
- **Package:** `TXTextControl.TXSheetControl.Server` (assembly `TXTextControl.TXSheetControl.Api.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Package:** `TXTextControl.TXSheetControl.Blazor` (assembly `TXTextControl.TXSheetControl.Api.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Inherits:** `TXTextControl.TXSheetControl.Server.DocumentObject`
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Server > NameCollection Class
- **903 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/namecollection/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/namecollection/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/namecollection/llms-full.txt

---

Case-insensitive workbook or worksheet names; every operation uses the same scope as the JS collection.

### Syntax

```csharp
public class NameCollection
```

### Members

#### Methods

| Method | Description |
|---|---|
| [GetAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/namecollection/getasync-method/llms-full.txt) | Looks up a name in this explicit scope; unknown names raise a document error. |
| [ListAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/namecollection/listasync-method/llms-full.txt) | Reads detached definitions in this collection's scope. |
| [RemoveAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/namecollection/removeasync-method/llms-full.txt) | Removes a definition in this scope; formulas subsequently report an unresolved name. |
| [SetAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/namecollection/setasync-method/llms-full.txt) | Creates or replaces a formula/reference definition in this scope, as one undoable transaction. |

### Examples

Build a small report using this document API and return its PDF bytes. Pass a live control with a fresh workbook; the caller owns its lifetime.

```csharp
using TXTextControl.TXSheetControl.Server;

async Task<byte[]> CreateNameCollectionReportAsync(ServerSheetControl control)
{
    var book = control.Workbook;
    var sheet = await book.Sheets.AtAsync(0);
    await sheet.Cell("B8").SetValueAsync(120);
    await sheet.Cell("B9").SetValueAsync(80);
    await sheet.Cell("B10").SetFormulaAsync("=SUM(B8:B9)");

    var nameCollection = book.Names;
    await nameCollection.SetAsync("InvoiceTotal", "='" + (await sheet.GetNameAsync()).Replace("'", "''") + "'!$B$10");
    await sheet.Cell("D10").SetFormulaAsync("=InvoiceTotal");
    return await control.SaveAsync(StreamType.PDF);
}
```

### See Also

- [TXTextControl.TXSheetControl.Server Namespace](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/llms-full.txt)
- [Workbooks and Worksheets](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/workbooks/llms-full.txt)

---

## In This Section

- [NameCollection.GetAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/namecollection/getasync-method/llms-full.txt): NameCollection.GetAsync method in the TX Sheet Control .NET API: Looks up a name in this explicit scope; unknown names raise a document error.
- [NameCollection.ListAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/namecollection/listasync-method/llms-full.txt): NameCollection.ListAsync method in the TX Sheet Control .NET API: Reads detached definitions in this collection's scope.
- [NameCollection.RemoveAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/namecollection/removeasync-method/llms-full.txt): NameCollection.RemoveAsync method in the TX Sheet Control .NET API: Removes a definition in this scope; formulas subsequently report an unresolved name.
- [NameCollection.SetAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/namecollection/setasync-method/llms-full.txt): NameCollection.SetAsync method in the TX Sheet Control .NET API: Creates or replaces a formula/reference definition in this scope, as one undoable transaction.

---

## Nearby

- **Previous:** [MailMergeTemplate.SaveAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/mailmergetemplate/saveasync-method/llms-full.txt)
- **Next:** [NameCollection.GetAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/namecollection/getasync-method/llms-full.txt)
